Results 1 to 5 of 5

Thread: Problem with Quartz and Spring (durable jobs)

  1. #1
    Join Date
    Aug 2005
    Posts
    1

    Default Problem with Quartz and Spring (durable jobs)

    I'm having a problem scheduling jobs via Spring and quartz, using Tomcat5 as my container.

    The exception thrown (during application start) is:
    Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFa ctoryBean' defined in ServletContext resource [/WEB-INF/jobs-context.xml]: Initialization of bean failed; nested exception is org.quartz.SchedulerException: Jobs added with no trigger must be durable.
    org.quartz.SchedulerException: Jobs added with no trigger must be durable.
    My XML doesn't appear to be very complex, and my job does appear to have a trigger:

    <beans>

    <bean id="updateLibraryJob" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="libraryService"/>
    <property name="targetMethod" value="updateLibrary"/>
    <property name="concurrent" value="false"/>
    </bean>



    <bean id="updateLibTrigger" class="org.springframework.scheduling.quartz.CronT riggerBean">
    <property name="jobDetail">
    <ref bean="updateLibraryJob"/>
    </property>
    <property name="cronExpression" value="0 0 4 * * ?"/>
    </bean>

    <!-- ===================== The actual scheudler ===================== -->
    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="updateLibTrigger"/>
    </list>
    </property>
    </bean>
    </beans>
    Am I missing something simple? Please let me know if there is an obvious issue, or whether I've run up against a known bug.

    ~KeithC

  2. #2

    Default org.quartz.SchedulerException: Jobs added with no trigger must be durable.

    I am having the same issue, also using Tomcat5 as my container.

    KeithC where you ever able to resolve this?

    I am running the nearly the exact same code that is shown in the spring doc: "Using the OpenSymphony Quartz Scheduler" : http://static.springframework.org/sp...cheduling.html

    applicationContext.xml
    Code:
    <bean name="exampleJob" class="org.springframework.scheduling.quartz.JobDetailBean">
      <property name="jobClass" value="com.scheduler.job.ExampleJob"/>
      <property name="jobDataAsMap">
        <map>
          <entry key="timeout" value="5"/>
        </map>
      </property>
    </bean>
    
    	
    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
      <property name="jobDetail" ref="exampleJob"/>
    	<!-- run every morning at 6 AM -->
      <property name="cronExpression" value="0 0 6 * * ?"/>
    </bean>
    
    		
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
      <property name="triggers">
        <list>
          <ref bean="cronTrigger"/>
        </list>
      </property>
    </bean>
    ExampleJob.java
    Code:
    public class ExampleJob extends QuartzJobBean {
    
    	  private int timeout;
    	  
    	  /**
    	   * Setter called after the ExampleJob is instantiated
    	   * with the value from the JobDetailBean (5)
    	   */ 
    	  public void setTimeout(int timeout) {
    	    this.timeout = timeout;
    	  }
    	  
    	  protected void executeInternal(JobExecutionContext ctx)
    	  throws JobExecutionException {
    	      // do the actual work
    	  }
    	}
    error:
    Code:
    org.quartz.SchedulerException: Jobs added with no trigger must be durable.
    	at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:539)
    	at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:231)
    	at org.springframework.scheduling.quartz.SchedulerFactoryBean.addJobToScheduler(SchedulerFactoryBean.java:754)
    Any thoughts on this one?

    Thanks,

    Keith

  3. #3

    Default Fixed Issue

    The problem was my Quartz jar was out of date. I updated the jar, and am no longer having any issues.

    Keith

  4. #4
    Join Date
    Jan 2006
    Location
    Lake of Constance, Germany
    Posts
    8

    Default

    so which version actually solves this problem?

    I do have the same problem too. (I'm using weblogic 8.13)

    cheers Kai

  5. #5
    Join Date
    Oct 2006
    Posts
    1

    Default Here is a sample configuration for Persistant Scheduled Jobs

    I was having the same problem as above. I was attempting to schedule persistant jobs and got the error because the jobs were not being stored in the db.
    Code:
        <!-- Load Quartz scheduling http://www.springframework.org/docs/reference/scheduling.html -->
        <bean id="exampleJob" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass" value="com.janus.service.schedule.EmailNotifyJob" />
            <property name="volatility" value="true" />
            <!--<property name="durability" value="true" />-->
            <!--<property name="requestsRecovery" value="true" />-->
            <property name="name" value="exampleJob" />
            <!--<property name="group" value="sample_1" />-->
            <property name="jobDataAsMap">
                <map>
                    <entry key="timeout" value="5" />
                </map>
            </property>
        </bean>
        <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
            <!-- see the example of method invoking job above -->
            <property name="jobDetail" ref="exampleJob" />
            <property name="volatility" value="true"/>
            <!--<property name="jobGroup" value="sample_1"/>-->
            <!-- 10 seconds -->
            <!--<property name="startDelay" value="10000" />-->
            <property name="repeatCount" value="5" />
            <!-- repeat every 50 seconds -->
            <property name="repeatInterval" value="50000" />
        </bean>
        <bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="dataSource" ref="dataSource"/>
            <property name="transactionManager" ref="transactionManager"/>
            <property name="autoStartup" value="true"/>
            <property name="waitForJobsToCompleteOnShutdown" value="true"/>
            <property name="applicationContextSchedulerContextKey" value="applicationContext" />
            <property name="quartzProperties">
            <props>
    
            <prop key="org.quartz.scheduler.instanceName">SampleScheduler</prop>
            <prop key="org.quartz.scheduler.instanceId">sample_1</prop>
    
            <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
            <prop key="org.quartz.threadPool.threadCount">5</prop>
            <prop key="org.quartz.threadPool.threadPriority">1</prop>
    
            <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.PostgreSQLDelegate</prop>
            <prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
            <prop key="org.quartz.jobStore.isClustered">true</prop>
    
            <prop key="org.quartz.plugin.shutdownHook.class">org.quartz.plugins.management.ShutdownHookPlugin</prop>
            <prop key="org.quartz.plugin.shutdownHook.cleanShutdown">true</prop>
            <!--<prop key="org.quartz.plugin.triggHistory.class">org.quartz.plugins.history.LoggingJobHistoryPlugin</prop>-->
            <prop key="org.quartz.plugin.triggHistory.triggerFiredMessage">Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}</prop>
            <prop key="org.quartz.plugin.triggHistory.triggerCompleteMessage">Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}</prop>
    
            </props>
            </property>
            <property name="jobDetails">
                <list>
                    <ref bean="exampleJob"/>
                </list>
            </property>
            <property name="triggers">
                <list>
                    <ref bean="simpleTrigger"/>
                </list>
            </property>
            <property name="schedulerContextAsMap">
                <map>
                    <entry key="mailEngine">
                        <ref bean="mailEngine"/>
                    </entry>
                    <entry key="message">
                        <ref bean="mailMessage"/>
                    </entry>
                </map>
            </property>
        </bean>

Similar Threads

  1. Scheduling Jobs with Quartz and Spring
    By MmarcoM in forum Container
    Replies: 4
    Last Post: Mar 2nd, 2010, 02:23 PM
  2. Runtime Quartz jobs and ApplicationContext
    By vmarcinko in forum Container
    Replies: 7
    Last Post: Feb 5th, 2008, 11:21 PM
  3. Replies: 1
    Last Post: May 15th, 2005, 06:37 AM
  4. Problem integrating spring with quartz
    By viniciusboson in forum Container
    Replies: 7
    Last Post: Nov 25th, 2004, 04:21 AM
  5. Replies: 1
    Last Post: Nov 10th, 2004, 03:40 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
  •