Java 无法解析对bean';cronTrigger';设置bean属性时';触发器';使用键[0]
不管怎样,我在lib文件夹中得到了2个版本的quartz jar。它正在工作 我正在将一个使用Quartz 1.7.3的界面升级到2.2.2 我解决了编译问题,但现在我发现了一些启动错误,我相信这些错误是由于上下文文件中的问题造成的,但我不确定是什么错了 错误似乎与定义调度程序和触发器有关 错误:Java 无法解析对bean';cronTrigger';设置bean属性时';触发器';使用键[0],java,spring,quartz-scheduler,Java,Spring,Quartz Scheduler,不管怎样,我在lib文件夹中得到了2个版本的quartz jar。它正在工作 我正在将一个使用Quartz 1.7.3的界面升级到2.2.2 我解决了编译问题,但现在我发现了一些启动错误,我相信这些错误是由于上下文文件中的问题造成的,但我不确定是什么错了 错误似乎与定义调度程序和触发器有关 错误: INFO | jvm 1 | 2018/06/26 09:24:41 | org.springframework.beans.factory.BeanCreationException: E
INFO | jvm 1 | 2018/06/26 09:24:41 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'intAppService' defined in file [E:\Southern\Apps\INTG\PRDEL\PRDEL01\config\PRdelApp-context.xml]:
Cannot resolve reference to bean 'quartzScheduler' while setting bean property 'quartzScheduler'; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'quartzScheduler' defined in file [E:\Southern\Apps\INTG\PRDEL\PRDEL01\config\PRdelApp-context.xml]: Cannot resolve reference to bean 'cronTrigger' while setting bean property 'triggers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'cronTrigger' defined in file [E:\Southern\Apps\INTG\PRDEL\PRDEL01\config\PRdelApp-context.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
背景:
<?xml version="1.0" encoding="UTF-8"?>
<!--Application context definitions for DispatcherServlet.-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
default-autowire="no" >
<!-- ========================= GENERAL DEFINITIONS ========================= -->
<!-- Enable load-time weaving for instrumentation. -->
<!-- Remove in later versions of spring -->
<!-- <context:load-time-weaver/> -->
<!-- Configurer that replaces ${...} placeholders with values from properties files -->
<bean id="propertyConfigurer" class="com.southerncompany.primavera.common.spring.PrimaveraNestedPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:config/application.properties</value>
</list>
</property>
<property name="nestedLocations">
<list>
<value>${app.config.db}/primavera.properties</value>
</list>
</property>
<property name="bootstrapHomePropertyName" value="primavera.bootstrap.home"/>
<property name="bootstrapFolder" value="${app.primavera.bootstrap.folder}"/>
<property name="bootstrapConfiguration" value="${primavera.configuration}"/>
</bean>
<bean id="applicationVersion" class="java.lang.String">
<constructor-arg type="java.lang.String" value="${app.version}"/>
</bean>
<!-- =============================== DOMAIN ============================ -->
<bean name="intAppService" class="com.southerncompany.primavera.prdel.QuartzTaskScheduler" init-method="listen">
<property name="name" value="PvJobListener" />
<property name="quartzScheduler" ref="quartzScheduler"/>
</bean>
<bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="autoStartup" value="false" />
<property name="schedulerName" value="PvScheduler" />
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="serviceTask" />
<property name="targetMethod" value="run" />
<property name="concurrent" value="false" />
<property name="group" value="PV" />
<property name="name" value="${app.service.name}${app.service.instance}-Job" />
<!--<property name="jobListenerNames">
<list>
<value>PvJobListener</value>
</list>
</property>-->
</bean>
<bean name="serviceTask" class="com.southerncompany.primavera.prdel.ProjDeleteService">
<property name="serviceTaskName" value="${app.service.name}${app.service.instance}"/>
<property name="primaveraSessionService" ref="primaveraSessionService"/>
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="jobDetail" />
<!--property name="cronExpression" value="10 0/01 * * * ?" /-->
<!-- run every 5 mins -->
<property name="cronExpression" value="0 0/5 * * * ?" />
<!-- run twice a day at 3am and 3pm -->
<!-- <property name="cronExpression" value="0 0 2,15 ? * *" /> -->
<!-- run every 30 minutes, at 10 seconds after the minute (i.e. 10:00:10 am, 10:30:10 am, etc.) -->
<!--property name="cronExpression" value="10 0/30 * * * ?" /> -->
</bean>
<!-- Application shutdown even listeners. Externally loaded by main class. -->
<bean id="serviceStopEventListeners" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
</list>
</property>
</bean>
<bean id="primaveraSessionService" class="com.southerncompany.primavera.common.primavera.ApiSessionService" init-method="login">
<property name="bootstrapKey" value="primavera.bootstrap.home" />
<property name="bootstrapHome" value="${primavera.bootstrap.home}" />
<property name="autoLoginDatabaseName" value="${primavera.login.databaseName}" />
<property name="autoLoginUserName" value="${app.primavera.login.userid}" />
<property name="autoLoginPassword" value="${app.primavera.login.password}" />
</bean>
文件:config/application.properties
${app.config.db}/primavera.properties
听起来像是春天的
CronTriggerFactoryBean
的过时版本
Quartz 2将
org.Quartz.CronTrigger
从类更改为接口,因此您确实需要兼容版本的CronTriggerFactoryBean
。我会检查spring context support.jar的版本在.war
文件中,在类路径上,等等。不管怎样,我在lib文件夹中得到了两个版本的quartz jar。现在开始工作了,谢谢你的回复。我也发现了这个版本的更新,并在发布后进行了更正。现在一切似乎都很好!