Results 1 to 5 of 5

Thread: Quartz -Setting the timezone in the CronTriggerBean

  1. #1

    Default Quartz -Setting the timezone in the CronTriggerBean

    Hi, the following is the bean definition for a trigger i'm using -
    <bean id="cronMaintenanceTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail">
    <ref bean="maintenanceJob"/>
    </property>
    <property name="cronExpression">
    <value>0 0 18 ? * MON-FRI</value>
    </property>
    <!--
    <property name="timeZone">
    <value>EST</value>
    </property>
    -->
    </bean>

    How do i set the timeZone in the CronTriggerBean?
    The setTimeZone() method uses a java.util.timeZone object as it's parameter, and hence I can't pass a string.
    Any help will be appreciated. Thanks.
    -D

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    You can create a reference to a TimeZone object using the following snippet:

    <bean id="timeZone" class="java.util.TimeZone" factory-method="getTimeZone">
    <constructor-arg>America/Los_Angeles</constructor-arg>
    </bean>

    You can then inject this bean into the timeZone property.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3

    Default Thank you!

    Worked like a charm. Thanks a bunch!
    -D

  4. #4

    Default Spring + Quartz + GMT timezone.

    I want to set the Cron expression in GMT timezone.

    I have gone through the link:
    http://forum.springframework.org/sho...uartz+timezone

    I have done this setting, but getting the error:
    The content of element type "constructor-arg" must match
    "(description?,(bean|ref|idref|value|null|list|set |map|props)?)".

    Code:
    <bean id="timeZone" class="java.util.TimeZone" factory-method="getTimeZone">
       <constructor-arg>America/Los_Angeles</constructor-arg>
    </bean>
    
    <bean id="MyTRIGGER" class="org.springframework.scheduling.quartz.CronTriggerBean">
    	<property name="jobDetail" ref="MyJOB" />
           <!--<property name="timeZone">
    	//how to inject that bean into the timeZone property.
                 	<value>America/Los_Angeles</value>
    	</property>
           -->
    	<property name="cronExpression"><value>${MyExpressionFromProperty}</value></property>
    </bean>
    Do I need to do any extra setting to let know the cronExpression that it needs to run in that GMT in our 'Spring Job' which extends 'QuartzJobBean'.
    Regards,
    I.M.

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    Does it simply need to read.......
    <constructor-arg value="America/Los_Angeles"/>

Similar Threads

  1. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  2. Replies: 1
    Last Post: Jul 12th, 2005, 03:51 PM
  3. Spring/Hibernate Delete/Update Problem
    By Noname in forum Data
    Replies: 4
    Last Post: Jun 15th, 2005, 11:07 PM
  4. Transaction Management
    By caverns in forum Data
    Replies: 3
    Last Post: Mar 8th, 2005, 06:38 AM
  5. Quartz problem
    By khem in forum Web
    Replies: 4
    Last Post: Aug 17th, 2004, 02:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •