Spring 3 + Quartz 2 error
java, quartz-scheduler, spring
Solution
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.
Problem
I received the error below when I use Spring 3 with Quartz 2. Does anyone knows the reason? Error: ``` 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 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 { ***** } } ```