在Spring 3石英调度程序应用程序中,我得到了java.lang.IncompatibleClassChangeError
此处总异常日志
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'JobOne' defined in class path resource [resources/quartz-context.xml]: problem with class file or dependent class; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1265)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:590)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.fourgid.epdsscheduler.MainScheduleApp.init(MainScheduleApp.java:21)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
石英context.xml中
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="jobA" class="com.fourgid.quartz.schedules.JobOneTrigger" />
<bean id="jobB" class="com.fourgid.quartz.schedules.JobTwoTrigger" />
<bean id="jobC" class="com.fourgid.quartz.schedules.JobThreeTrigger" />
<!-- Quartz Job -->
<bean name="JobOne" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.fourgid.quartz.schedules.JobOneTrigger" />
</bean>
<bean name="JobTwo" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.fourgid.quartz.schedules.JobTwoTrigger" />
</bean>
<bean name="JobThree" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.fourgid.quartz.schedules.JobThreeTrigger" />
</bean>
<!-- Cron Trigger, run every 5 seconds -->
<bean id="cronTriggerJobOne" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="JobOne" />
<property name="cronExpression" value="0 0 1 ? * *" />
</bean>
<bean id="cronTriggerJobTwo" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="JobTwo" />
<property name="cronExpression" value="0 0 9 ? * *" />
</bean>
<bean id="cronTriggerJobThree" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="JobThree" />
<property name="cronExpression" value="0 0 3 ? * *" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTriggerJobOne" />
<ref bean="cronTriggerJobTwo" />
<ref bean="cronTriggerJobThree" />
</list>
</property>
</bean>
</beans>
感谢您的帮助
答案 0 :(得分:1)
Quartz 2 API发生了很大变化。此时,Spring 3与Quartz 2 NOT COMPATIBLE 。
如果您使用的是Spring 3.x&amp; Quartz 2.1.x,然后只进行两次更改。
1st:for Simple Trigger
使用class=”org.springframework.scheduling.quartz.SimpleTriggerFactoryBean”>
第二名:Cron Trigger
使用class=”org.springframework.scheduling.quartz.CronTriggerFactoryBean”>