实例化作业时 Quartz Scheduler 错误
我正在尝试将 Quartz 2.1.1 与 Spring 3.0.5 一起使用。
我用这一行设置了调度程序:
我编写了一个名为 TestJob
的简单类,它实现了 作业
界面。我能够成功设置作业并触发和安排它。问题是,当触发作业并且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
有关如何解决此问题的任何想法吗?
I am trying to use Quartz 2.1.1 with Spring 3.0.5.
I set up the Scheduler with this line:<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"/>
I wrote a simple class called TestJob
that implements the Job
interface. I am able to successfully set up a job and trigger and schedule it. The problem is that when the job is triggered and quartz tries to instantiate the TestJob
class, I am getting this error:
[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
Any ideas on how to get around this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
石英2和弹簧< 3.1 不兼容。因此,您可以更新到 Spring 3.1 或降级到 Quartz 1.8。或者您放弃 Spring Quartz 适配器并手动使用 Quartz 2。我推荐第一种方法。
Quartz 2 and Spring < 3.1 are incompatible. So you can either update to Spring 3.1 or downgrade to Quartz 1.8. Or you drop the Spring Quartz adapters and use Quartz 2 by hand. I recommend the very first method.
您还可以将 jobFactory 分配给石英自定义作业工厂“SimpleJobFactory”
You also can assign the jobFactory to quartz custom job factory "SimpleJobFactory"
我刚刚遇到了一个非常类似的问题,导致我来到这里 - 由重构作业的包引起 - 一切正常,直到将其部署到集群 -quartz jdbc 使用带有 job_name 列的表,旧包仍然存在,因此它因同样的错误而窒息。删除保留的触发器行,或将其放回到要解析的位置。
I just had a very similar problem that led me here - caused by refactoring a job's package - everything worked till it was deployed to a cluster - quartz jdbc uses tables with job_name column with the old package persisted so it choked with this same error. Delete the persisted trigger rows, or put it back where it was to resolve.