日期:2014-05-17  浏览次数:20613 次

spring job定时器问题
spring.xml配置如下
<bean id="batchLimitAdjustImpl" class="cn.sunline.suncard.acd.batch.service.impl.BatchLimitAdjustImpl">
<property name="acdCopyToNewApplyService" ref="acdCopyToNewApplyServiceImpl"/>
</bean>
 
<bean id="limitAdjustTimerJob" class="org.springframework.scheduling.quartz.JobDetailBean">  
  <property name="jobClass" value="cn.sunline.suncard.acd.batch.job.func.LimitAdjustProcessor"/>  
  <property name="jobDataAsMap">  
  <map>  
  <entry key="batchLimitAdjust" value-ref="batchLimitAdjustImpl"></entry>
  </map>  
  </property>
  </bean>
   
  <!-- 简单的触发器 -->  
  <bean id="simpleLimitAdjustTimerTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">  
  <property name="jobDetail">  
  <ref bean="limitAdjustTimerJob" />  
  </property>  
  <!-- 以毫秒为单位,启动后一分钟触发 -->  
  <property name="startDelay">  
  <value>60000</value>  
  </property>  
  <!-- 每间隔一分钟触发一次 -->  
  <property name="repeatInterval">  
  <value>60000</value>  
  </property>  
  </bean>
   
  <!-- 复杂的触发器 -->
  <bean id="complexLimitAdjustTimerTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">  
  <property name="jobDetail">  
  <ref bean="limitAdjustTimerJob"/>  
  </property>  
  <property name="cronExpression">  
  <!-- 这里是重点,可以自定义表达式实现定时触发。以下含义是每天16点触发一次 -->  
<value>0 0 16 * * ?</value>
  </property>  
  </bean>
   
  <!-- Spring触发工厂 -->  
  <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">  
  <property name="triggers">  
  <list>  
  <ref bean="complexLimitAdjustTimerTrigger"/>  
  <!-- ....下面可以继续添加其他触发器 -->  
  </list>  
  </property>  
  </bean>

出现了如下问题,好像是包冲突问题。可是换了quartz-2.1.5.tar、quartz-1.8.6.tar、quartz-1.7.3.tar这些版本都是错的。同样的错误,如下:


严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'limitAdjustTimerJob' defined in ServletContext resource [/WEB-INF/config/spring-jobs.xml]: problem with class file or dependent class; nested exception is