2

我有一个网络应用程序,它必须每天做一些事情,比如说每个月的第一天。

这是一个 GWT 应用程序,分为 4 个项目(如果这很重要),我使用 Maven 添加了这些 jars(更新了我的 pom.xml):

opensymphony quartz 1.6.3 commons-collections

由于我已经在使用 Spring,因此我遵循了本教程(法语教程

并在我的 application-context.xml 文件中添加了教程中编写的内容。

在编译时,没问题,但在运行时,我有这个错误:

com.google.gwt.user.client.rpc.StatusCodeException: Error 500 Error creating bean with name 'schedulerFactory' defined in class path resource [application-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 class path resource [application-context.xml]: Error setting property values;nested exception is org.springframework.beans.PropertyBatchUpdateException;nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'cronExpression' threw exception;nested exception is java.text.ParseException: Unexpected end of expression.

它从何而来 ?

我的 application-context.xml 的一部分:

<!-- Configuration du crontrigger -->
<bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="cronTrigger" />
        </list>
    </property>
</bean>
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
        <ref local="exampleJob" />
    </property>

    <!-- run every day at 6AM -->
    <property name="cronExpression" value="0 0 6 * * ?" />
</bean>
<bean id="exampleJob" class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass" value="fr.web.utils.ExampleJob" />
    <property name="jobDataAsMap">
        <map>
            <entry key="timeout" value="5" />
        </map>
    </property>
</bean>
4

1 回答 1

4

cronTrigger问题是您在未在 XML 文件中声明的调度程序触发器中给出了参考 。

提供 XML 以获得更详细的答案

更新

您的 cronExpression 似乎无效 0 0 6 * * ?0 0 6 * *  ?请注意之前的最后一个空格?

于 2011-04-21T10:06:01.673 回答