繁体   English   中英

使用键[0]设置bean属性“触发”时,无法解析对bean“ cronTrigger”的引用

[英]Cannot resolve reference to bean 'cronTrigger' while setting bean property 'triggers' with key [0]

不管,我以某种方式在lib文件夹中得到了2个版本的石英罐。 现在正在工作。

我正在努力将用于使用Quartz 1.7.3的接口升级到2.2.2

我已经解决了编译问题,但现在遇到了启动错误,我认为该错误已本地化为上下文文件中的问题,但我不确定出什么问题。

该错误似乎与定义调度程序和触发器有关。

错误:

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>

听起来像Spring中CronTriggerFactoryBean的过时版本- 一个类似的问题

Quartz 2将org.quartz.CronTrigger从一个类更改为一个接口,因此您确实需要兼容版本的CronTriggerFactoryBean 我将检查.war文件,classpath等上的spring-context-support.jar版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM