Announcement Announcement Module
Collapse
No announcement yet.
What Maven dependencies do I need to include Quartz support? Failing with NoClass Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • What Maven dependencies do I need to include Quartz support? Failing with NoClass

    Hi,

    I'm trying to add quartz scheduling to my app, but am hitting a wall as to which dependencies I need for my pom.xml. According to the Spring maven artifacts page, I need:
    Code:
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context-support</artifactId>
    			<version>3.0.5.RELEASE</version>
    		</dependency>
    But when i try to launch my app, I get the following error message.
    Code:
    Caused by: java.lang.NoClassDefFoundError: org/quartz/CronTrigger
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    If I try to manually include Quartz 2.0.2 dependency
    Code:
    		<dependency>
    		    <groupId>org.quartz-scheduler</groupId>
    		    <artifactId>quartz</artifactId>
    		    <version>2.0.2</version>
    		</dependency>
    I get the following error message:
    Code:
    Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.CronTriggerBean has interface org.quartz.CronTrigger as super class
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)


    My Job configuration is as follows:
    Code:
    	<bean id="com.funcom.fwl.jobs.BuiltInScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">
    		<property name="triggers">
    			<list>
    				<!-- trigger list -->
    				<ref bean="fwl.service.TrendLeaderArticleService.trigger" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="fwl.service.TrendLeaderArticleService.trigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    	 	<property name="cronExpression" value="0/30 * * * * ? *" />
    		<property name="jobDetail">
    			<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
    				<property name="name" value="fwl.service.TrendLeaderArticleService" />
    				<property name="group" value="news" />
    				<property name="targetObject" ref="trendLeaderArticleServiceImpl"/>
    				<property name="targetMethod" value="createTrendLeaderArticle"/>
    				<property name="concurrent" value="false" />
    			</bean>
    		</property>
    	</bean>



    Can someone untangle me please and point me in the right direction?

    Thanks,

    Eric

  • #2
    After a bunch of random trial and error, I discovered that Spring 3.0.5.RELEASE is compatible with Quartz 1.8.5 but not 2.0.

    Consequently, need the following dependency in addition to the spring-context-support module :
    Code:
    		<dependency>
    		    <groupId>org.quartz-scheduler</groupId>
    		    <artifactId>quartz</artifactId>
    		    <version>1.8.5</version>
    		</dependency>
    Hope this helps someone else!

    Eric

    Comment


    • #3
      Thanks! it helped me a lot!

      Comment


      • #4
        thanks saved my time.

        Comment


        • #5
          Also, try using MAVEN in your project. Maven automatically resolves necessary dependencies. When not sure about the version, check the pom.xml of the module that you're using i.e. spring-context-support. It specifies that spring-context-support depends upon version 1.6.2 of quartz. Since 2.X version of quartz is a major release, including this should be avoided.

          Comment

          Working...
          X