Spring 3 + Quartz 2错误 [英] Spring 3 + Quartz 2 error

查看:248
本文介绍了Spring 3 + Quartz 2错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用带有Quartz 2的Spring 3时,我收到了以下错误。有谁知道原因?

I received the error below when I use Spring 3 with Quartz 2. Does anyone knows the reason?

错误:

Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'job' defined in class path resource [beans.xml]: problem with class file or dependent class; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1253)

Spring配置文件:

Spring config file:

<bean name="job" class="org.springframework.scheduling.quartz.JobDetailBean">
  <property name="jobClass" value="Example.ExampleJob"/>
  <property name="jobDataAsMap">
    <map>
      <entry key="timeout" value="5"/>
    </map>
  </property>
</bean>

<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
  <property name="jobDetail" ref="job"/>
  <property name="startDelay" value="1000"/>
  <property name="repeatInterval" value="5000"/>
</bean>

public class ExampleJob extends QuartzJobBean {

      private int timeout;

      /**
       * Setter called after the ExampleJob is instantiated
       * with the value from the JobDetailBean (5)
       */ 
      public void setTimeout(int timeout) {
        this.timeout = timeout;
      }

    @Override
    protected void executeInternal(JobExecutionContext ctx)
            throws JobExecutionException {
        *****
    }

}


推荐答案

最后我查了一下,春天不支持Quartz 2.请查看最新的Spring版本是否添加了所述支持,或者尝试降级到Quartz 1.8.x.

Last I checked, Spring doesn't have support for Quartz 2. Either have a look to see if the most recent Spring builds have added said support, or try downgrading to Quartz 1.8.x.

这篇关于Spring 3 + Quartz 2错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆