Announcement Announcement Module
Collapse
No announcement yet.
Problem with Quartz and Spring (durable jobs) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      Fixed Issue

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

      Keith

      Comment


      • #4
        so which version actually solves this problem?

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

        cheers Kai

        Comment


        • #5
          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>

          Comment


          • #6
            It still happens with the most recent versions of Spring 4.0.3.RELEASE and Quartz 2.2.1.
            Quick debugging of Spring code showed me that it's clearly a Spring's bug. Let me find where how to file it...

            Comment

            Working...
            X