开发者

configuration of a cronTrigger (with opensymphony quartz)

I have a web app that has to do something every, let's say first day of every month.

It's a GWT application divided into 4 projects (if that ever matters) and I added these jars using Maven (which updated my pom.xml):

opensymphony quartz 1.6.3 commons-collections

Since I am already using Spring, I followed this tutorial (Tutorial in French)

and added what's written in the tutorial in my application-context.xml file.

At compile time, no problem, but at runtime, I have this error :

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.

Where does it come from ?

A part of my 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>


Issue is you have given reference in Scheduler's trigger cronTrigger which you haven't declare in the XML file.

Provide XML for more detailed answer

Update

Your cronExpression isn't seems to be valid 0 0 6 * * ? make it 0 0 6 * *  ? note the last space before ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜