Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz Scheduler Error when Instantiating Job

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?

like image 222
Arun V Avatar asked Jan 25 '12 22:01

Arun V


2 Answers

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.

like image 147
Hauke Ingmar Schmidt Avatar answered Oct 10 '22 19:10

Hauke Ingmar Schmidt


You also can assign the jobFactory to quartz custom job factory "SimpleJobFactory"

like image 31
Blair Long Avatar answered Oct 10 '22 21:10

Blair Long