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.
Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.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

  • Pingback: alkaline water brands()

  • Pingback: water ionizer loan()

  • Pingback: stop parking()

  • Pingback: alkaline water benefits()

  • Pingback: water ionizer()

  • Pingback: youporn()

  • Pingback: car parking()

  • Pingback: lan her og nu()

  • Pingback: tv packages()

  • Pingback: Direct TV()

  • Pingback: kangen()

  • Pingback: alkaline water()

  • Pingback: water ionizer()

  • Pingback: watch movies online free()

  • Pingback: watch tv show episodes()

  • Pingback: watch free movies online()

  • Pingback: stream movies()

  • Pingback: Blue Coaster33()

  • http://www.persistent.co.in 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

      changing the configuration file can run success

  • http://www.persistent.co.in 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 [email protected]/[email protected]……

    Regards,
    Vijay

  • http://www.persistent.co.in vijay

    If any on Still facing problem then I can send complete source package. Contact me [email protected]/[email protected]……

    Regards,
    Vijay

  • http://www.persistent.co.in 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 TestQuartz;

    import org.springframework.context.support.ClassPathXmlApplicationContext;

    public class Start {
    public static void main(String[] args) throws Exception {
    new ClassPathXmlApplicationContext(“Spring-Quartz.xml”);

    }
    }

    Jun 27, 2013 11:31:43 AM org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup start
    INFO: Starting beans in phase 2147483647
    Jun 27, 2013 11:31:43 AM org.springframework.scheduling.quartz.SchedulerFactoryBean startScheduler
    INFO: Starting Quartz Scheduler now
    11:31:43.451 [main] INFO org.quartz.core.QuartzScheduler – Scheduler org.springframework.scheduling.quartz.SchedulerFactoryBean#0_$_NON_CLUSTERED started.
    11:31:43.452 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread – batch acquisition of 1 triggers
    11:31:44.260 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread – batch acquisition of 1 triggers
    11:31:44.260 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-1] DEBUG org.quartz.core.JobRunShell – Calling execute on job DEFAULT.runMeJob
    3.1.2.RELEASE + Quartz 2.1.7 ~
    11:31:44.440 [Timer-0] DEBUG org.quartz.utils.UpdateChecker – Checking for available updated version of Quartz…
    11:31:49.253 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread – batch acquisition of 1 triggers
    11:31:49.253 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-2] DEBUG org.quartz.core.JobRunShell – Calling execute on job DEFAULT.runMeJob
    3.1.2.RELEASE + Quartz 2.1.7 ~

  • Surya

    Thanks Kaushik Maulik and MkYong.

    Really helpful

    • Kaushik Chakraborty

      :) ur wlcm.

  • 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
      • Kaushik Chakraborty

        Sent you one spring-context.xml

    • Kaushik Chakraborty

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

    • Scindia

      Maulik, u saved my day. Thanks a lot.

    • 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

  • Pingback: Quartz Scheduler Tutorial ‹ ???()