3

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>
STW
  • 44,917
  • 17
  • 105
  • 161
l0r3nz4cc10
  • 1,237
  • 6
  • 27
  • 50

1 Answers1

4

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 ?

jmj
  • 237,923
  • 42
  • 401
  • 438
  • Well no error anymore. Thanks ! But could you explain the difference between my expression and yours ? – l0r3nz4cc10 Apr 21 '11 at 10:23
  • your expression wasn't just following syntax. it should be separated by space . See [*Cron-Expressions are used to configure instances of CronTrigger. Cron-Expressions are strings that are actually made up of seven sub-expressions, that describe individual details of the schedule. These sub-expression are separated with white-space*](http://www.quartz-scheduler.org/docs/tutorial/TutorialLesson06.html) – jmj Apr 21 '11 at 10:26