IncompatibleClassChangeError : JobDetailBean has interface org.quartz.JobDetail as super class

Developing Quartz 2.1.5 + Spring 3.1.2.RELEASE, hits following error messages :


Caused by: java.lang.IncompatibleClassChangeError: 
	class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
	... 19 more

Solution

Quartz 2 APIs are changed a lot, and someone already filled a bug report on Spring JIRA. At this moment, “Spring 3 is NOT COMPATIBLE with Quartz 2“.

Here are 3 alternatives :

  1. Use Quartz 1.8.5, Spring 3 is integrated great with Quartz 1.x, classic and stable also.
  2. Do not use Spring’s QuartzJobBean for integration, uses Quartz’s interface / class directly.
  3. Last, what else? Please wait for the bug fixed.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
vijay
Guest
vijay

If You are using Spring 3.x & Quartz 2.1.x…

Then do only two changes.
1st : for Simple Trigger

Use class=”org.springframework.scheduling.quartz.SimpleTriggerFactoryBean”> instead of
class=”org.springframework.scheduling.quartz.SimpleTriggerBean”>

2nd : for Cron Trigger
use class=”org.springframework.scheduling.quartz.CronTriggerFactoryBean” instead of
class=”org.springframework.scheduling.quartz.CronTriggerBean”

syws
Guest
syws

changing the configuration file can run success

sachin
Guest
sachin

it is working as expected..thanks a lot :)

Glauco Soares
Guest
Glauco Soares

Consegui com o JobDetailFactoryBean ao invez do JobDetailBean….

algo desse tipo

trackback
Quartz Scheduler Tutorial ‹ ???

[…] IncompatibleClassChangeError : JobDetailBean has interface org.quartz.JobDetail as super class […]

Sandeep
Guest
Sandeep

I too faced this error and this portal helps me.

Parvathy
Guest
Parvathy

Thanks a lot

vijay
Guest
vijay

If any one Still getting error like

Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class

then I can send complete source package which works with Spring 3.x & Quartz 2.1.7. Contact me vijay_shankar@persistent.co.in/vijayshankerbhatt@gmail.com……

Regards,
Vijay

vijay
Guest
vijay

If any on Still facing problem then I can send complete source package. Contact me vijay_shankar@persistent.co.in/vijayshankerbhatt@gmail.com……

Regards,
Vijay

vijay
Guest
vijay
Perfect Solution if you using Spring 3.x & Quartz 2.1.7, jdk 1.7 1 step : Add following dependency in pom.xml org.springframework spring-tx 3.1.2.RELEASE org.springframework spring-context-support 3.1.2.RELEASE org.springframework spring-core 3.1.2.RELEASE org.quartz-scheduler quartz 2.1.7 2 Step : Full Configuration file :Spring-Quartz.xml <!– Spring Quartz –> |RunMeJob.java| package TestQuartz; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean; public class RunMeJob extends QuartzJobBean { private RunMeTask runMeTask; public void setRunMeTask(RunMeTask runMeTask) { this.runMeTask = runMeTask; } protected void executeInternal(JobExecutionContext context) throws JobExecutionException { runMeTask.printMe(); } } |RunMeTask.java| package TestQuartz; public class RunMeTask { public void printMe() { System.out.println(“Spring 3 + Quartz 2.1.7”); } } |Start.java| package… Read more »
Surya
Guest
Surya

Thanks Kaushik Maulik and MkYong.

Really helpful

Kaushik Chakraborty
Guest
Kaushik Chakraborty

:) ur wlcm.

Maulik
Guest
Maulik

Hi,

I am able to configure Quartz 2.1.6 successfully with Spring 3.1. To resolve above issue use JobDetailFactoryBean instead of JobDetailBean and use SimpleTriggerFactoryBean instead of SimpleTriggerBean.

Kaushik Chakraborty
Guest
Kaushik Chakraborty

@Maulik can you plz mail me a sample working app with Spring 3.x + quartz 2.x to kcchat@gmail.com.

Thanks in Advance

Kaushik Chakraborty
Guest
Kaushik Chakraborty

Sent you one spring-context.xml

Kaushik Chakraborty
Guest
Kaushik Chakraborty

Thanks your comment helped me out. Instead of CronTriggerBean, I’m using CronTriggerBeanFactory.

Scindia
Guest
Scindia

Maulik, u saved my day. Thanks a lot.

Prasad
Guest
Prasad

HI,
I am using spring 3.1.1 and quartz 2.2.1 .i configured quartz scheduler as told you above.But , i am getting Exception like below .

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘job’ defined in ServletContext resource [/META-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.springframework.scheduling.quartz.JobDetailFactoryBean.afterPropertiesSet(JobDetailFactoryBean.java:201)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
… 22 more