我正在尝试使用Quartz 2.1.1和Spring 3.0.5.
我用这一行设置了Scheduler:
< bean id =“scheduler”class =“org.springframework.scheduling.quartz.SchedulerFactoryBean”/>
我写了一个名为TestJob的简单类,它实现了Job接口.我能够成功地设置一个工作并触发并安排它.问题是,当作业被触发并且quartz尝试实例化TestJob类时,我收到此错误:
[scheduler_QuartzSchedulerThread] ERROR core.ErrorLogger.schedulerError(2360) | An error occured instantiating job to be
executed. job= 'TEST_JOB.6d2e7ca2-20cd-4e5f-9f32-1626c7128a5d'
org.quartz.SchedulerException: Problem instantiating class 'com.scheduler.TestJob' - [See nes
ted exception: java.lang.AbstractMethodError: org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(Lorg/quar
tz/spi/TriggerFiredBundle;Lorg/quartz/Scheduler;)Lorg/quartz/Job;]
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:141)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:381)
Caused by: java.lang.AbstractMethodError: org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(Lorg/quartz/s
pi/TriggerFiredBundle;Lorg/quartz/Scheduler;)Lorg/quartz/Job;
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:134)
... 1 more
关于如何解决这个问题的任何想法?
最佳答案
Quartz 2和Spring< 3.1是不相容的.因此,您可以更新到Spring 3.1或降级到Quartz 1.8.或者您放下Spring Quartz适配器并手动使用Quartz 2.我推荐第一种方法.
原文链接:https://www.f2er.com/spring/431774.html