spring3.0整合Quartz时报错

spring3.0整合Quartz时出错:

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)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	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.util.ClassUtils.forName(ClassUtils.java:258)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:415)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1284)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1255)
	... 113 more


所用spring 的架包是3.0以上的 而quartz是2.x以上如下:
<dependency>
		  <groupId>org.quartz-scheduler</groupId>
		  <artifactId>quartz</artifactId>
		  <version>2.1.5</version>
		</dependency>


解决方法有2种:

第一种解决办法:将quartz版本降低到1.8以下( 不建议)

第二种解决办法: 将CronTriggerBean 改成 CronTriggerFactoryBean

你可能感兴趣的:(spring,exception,quartz)