问个spring任务调度的问题,用spring+quartz实现定时发邮件,发邮件类autoSendingMailJob在main里能正常工作,而单单独测试quartz框架system.out也能正常打出,就是把new autoSendingMailJob().start() 放入quartz的executeInternal方法中执行的时候就会抛出
invalid SHA1 signature file digest for javax/activation/DataContentHandlerFactory.class异常,是什么问题呢 请高手指教以下是我的测试任务在ecuteInternal调用spring注入的发邮件的组件public class TestJob extends QuartzJobBean{
public static Logger log = Logger.getLogger(TestJob.class); private autoSendingMailJob asmj;

public void setAsmj(autoSendingMailJob asmj) {
this.asmj = asmj;
} protected void executeInternal(JobExecutionContext arg0)
throws JobExecutionException {
// TODO Auto-generated method stub
try {
log.info("自动发送邮件任务开始>........");
asmj.start();
log.info("自动发送邮件任务结束!");
} catch (Exception e) {
log.error("自动发送邮件任务出现异常", e);
}
}

解决方案 »

  1.   

    javax/activation/DataContentHandlerFactory.class这个类所在jar包,是个signed的包,不能修改,如果修改了,就抛这个异常。
      

  2.   

    javax/activation/DataContentHandlerFactory.class这个类是在activation.jar里这个jar我从来就没动过,我后来把这个jar换了几个版本,结果异常还是一样的,郁闷死了下面是我的配置文件:<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="autoSendingMailJob"
    class="com.newWebSite.util.autoJob.autoSendingMailJob" /> <bean name="verifyJob"
    class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
    <value>com.newWebSite.util.autoJob.verifyJob</value>
    </property>
    </bean> <bean name="FirstJob"
    class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
    <value>com.newWebSite.util.autoJob.TestJob</value>
    </property>
    <property name="jobDataAsMap">
    <map>
    <entry key="asmj" value-ref="autoSendingMailJob" />
    </map>
    </property>
    </bean> <bean id="cronTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
    <ref bean="FirstJob" />
    </property>
    <property name="cronExpression">
    <value>0 35 22 * * ?</value>
    </property>
    </bean> <bean
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref local="cronTrigger" />
    </list>
    </property>
    </bean></beans>
      

  3.   

    javax/activation/DataContentHandlerFactory.class这个类是在activation.jar里这个jar我从来就没动过,我后来把这个jar换了几个版本,结果异常还是一样的,郁闷死了下面是我的配置文件:<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="autoSendingMailJob"
    class="com.newWebSite.util.autoJob.autoSendingMailJob" /> <bean name="verifyJob"
    class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
    <value>com.newWebSite.util.autoJob.verifyJob</value>
    </property>
    </bean> <bean name="FirstJob"
    class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
    <value>com.newWebSite.util.autoJob.TestJob</value>
    </property>
    <property name="jobDataAsMap">
    <map>
    <entry key="asmj" value-ref="autoSendingMailJob" />
    </map>
    </property>
    </bean> <bean id="cronTrigger"
    class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
    <ref bean="FirstJob" />
    </property>
    <property name="cronExpression">
    <value>0 35 22 * * ?</value>
    </property>
    </bean> <bean
    class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
    <list>
    <ref local="cronTrigger" />
    </list>
    </property>
    </bean></beans>