Results 1 to 5 of 5

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

  1. #1

    Default 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. #2

    Default

    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

  3. #3
    Join Date
    Nov 2007
    Location
    Hamburg - Germany
    Posts
    24

    Default

    Thanks! it helped me a lot!

  4. #4

    Default

    thanks saved my time.

  5. #5
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •