Reputation: 193
I am trying to create a cron job using Spring 4.0.1 and Quartz 1.5.2, but I get an error when I run it on my server. the error shows:
SEVERE: Servlet [appServlet] in web application [/SpringRestSample] threw load() exception
java.lang.ClassNotFoundException: org.quartz.impl.JobDetailImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
my xml configuration is :
<beans:bean id="removeExpiredSessionFetchJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<beans:property name="jobClass">
<beans:value>com.iris.spring.rest.model.RemoveExpiredSessionFetchJob</beans:value>
</beans:property>
</beans:bean>
<beans:bean id="removeExpiredSessionTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<beans:property name="jobDetail">
<beans:ref bean="removeExpiredSessionFetchJob" />
</beans:property>
<beans:property name="cronExpression">
<!-- <value>0 0/55 * * * ?</value> -->
<beans:value>0 */1 * * * ?</beans:value>
</beans:property>
</beans:bean>
<beans:bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<beans:property name="triggers">
<beans:list>
<beans:ref bean="removeExpiredSessionTrigger" />
</beans:list>
</beans:property>
</beans:bean>
my pom.xml is :
<properties>
<java-version>1.6</java-version>
<org.springframework-version>4.1.0.RELEASE</org.springframework-version>
<org.aspectj-version>1.7.4</org.aspectj-version>
<org.slf4j-version>1.7.5</org.slf4j-version>
<jackson.databind-version>2.2.3</jackson.databind-version>
</properties>
<dependency>
<groupId>quartz</groupId>
<artifactId>quartz</artifactId>
<version>1.5.2</version>
</dependency>
Upvotes: 1
Views: 7640
Reputation: 34776
quartz
/ quartz
is some old Quartz version, which according to Maven Repository webpage was moved to org.quartz-scheduler
/ quartz
. So the correct Quartz dependency, which contains the class JobDetailImpl
, which is missing according to your stack trace should be:
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
Upvotes: 9