我有一个web应用程序,它必须在每个月的第一天做一些事情。
这是一个被分成4个项目的GWT应用程序(如果这很重要的话),我使用Maven添加了这些jar(它更新了我的pom.xml):
opensymphony quartz 1.6.3 commons-集合
由于我已经在使用Spring,所以我遵循了本教程(Tutorial in French)
并将教程中编写的内容添加到我的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.它是从哪里来的?
我的应用程序的一部分-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>发布于 2011-04-21 18:06:02
问题是您在调度器的触发器cronTrigger中给出了引用,而您没有在XML文件中声明它。
提供XML以获得更详细的答案
更新
您的cronExpression似乎无效,请将其设为0 0 6 * * ?,请注意?前的最后一个空格
https://stackoverflow.com/questions/5742471
复制相似问题