views:

2385

answers:

2

Hi all, I am implementing Quartz Job Store on Oracle DB using Spring Framework. My ApplicationContext.xml is below

<bean id="driverJob" class="org.springframework.scheduling.quartz.JobDetailBean">
 <property name="jobClass" value="BatchFileCollector" />
</bean>

<bean id="ranchTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
 <property name="jobDetail" ref="driverJob" />
 <property name="startDelay" value="2000" />
 <property name="repeatInterval" value="10000" />
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
 <property name="triggers">
  <list>
   <ref bean="ranchTrigger" />
  </list>
 </property>
 <property name="dataSource">
  <ref bean="dataSource.TEXAN"/>
 </property>
 <property name="applicationContextSchedulerContextKey">
  <value>applicationContext</value>
 </property>
 <property name="autoStartup">
  <value>true</value>
 </property>
 <property name="configLocation" value="classpath:quartz.properties"/>
</bean>

This configuration gives me the below error.

Caused by: org.quartz.JobPersistenceException: Couldn't store trigger: The job (DEFAULT.driverJob) referenced by the trigger does not exist. [See nested exception: org.quartz.JobPersistenceException: The job (DEFAULT.driverJob) referenced by the trigger does not exist.]

I am using Spring Framework 2.5.6. Do I have to upgrade my Quartz version? I cannot find the problem.

Thanks for your help.

A: 

I'm not sure if this will work, but you could try using:

   <bean id="driverJob" .../>

instead of:

   <bean name="driverJob" .../>
dave
It doesn't work. BatchFileCollector class extends org.springframework.scheduling.quartz.QuartzJobBean.
Firstthumb
+3  A: 

Your SchedulerFactoryBean needs to have the "driverJob" registered, too. Along with your triggers, add a list of jobDetails.

Your SchedulerFactoryBean needs to have the "driverJob" registered, too. Along with your triggers, add a list of jobDetails.

<bean id="job.statistics.DailyQPSValidationJobTrigger" class="org.quartz.CronTrigger">
 <property name="name" value="DailyQPSValidationTrigger" />
 <property name="jobName" value="DailyQPSValidation" />
 <property name="jobGroup" value="Statistics" />
 <property name="volatility" value="false" />
 <!-- Each day, 4 o'clock AM -->
 <property name="cronExpression" value="0 0 4 * * ?" />
</bean>

<!-- Scheduler -->

<bean id="job.SchedulerProperties" class="somecompany.someproduct.util.spring.PropertiesFactoryBean"
 scope="singleton">
 <property name="source">
  <props>
   <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
   <prop key="org.quartz.scheduler.instanceName">JobCluster</prop>
   <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
   <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop>
   <prop key="org.quartz.jobStore.isClustered">true</prop>
   <prop key="org.quartz.jobStore.useProperties">false</prop>
  </props>
 </property>
</bean>

<bean id="job.Scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton"
 lazy-init="false">
 <property name="startupDelay" value="30" />
 <property name="waitForJobsToCompleteOnShutdown" value="true" />
 <property name="dataSource" ref="jdbc.DataSource" />
 <property name="quartzProperties" ref="job.SchedulerProperties" />
 <property name="jobDetails">
  <list>
   <ref bean="job.statistics.DailyQPSValidationJobDetail" />
  </list>
 </property>
 <property name="triggers">
  <list>
   <ref bean="job.statistics.DailyQPSValidationJobTrigger" />
  </list>
 </property>
 <property name="schedulerListeners">
  <list>
   <bean class="somecompany.someproduct.job.SchedulerErrorListener">
    <property name="monitoringService" ref="monitoring.MonitoringService" />
   </bean>
  </list>
 </property>
 <property name="globalJobListeners">
  <list>
   <bean class="somecompany.someproduct.job.JobErrorListener">
    <property name="name" value="JobErrorListener" />
    <property name="monitoringService" ref="monitoring.MonitoringService" />
   </bean>
  </list>
 </property>
</bean>
oeogijjowefi
I think there is no need to add driverJob to SchedulerFactoryBean because ranchTrigger Bean includes driverJob. Could you please send a sample configuration for Quartz JobStore using Spring Framework?
Firstthumb
Do you think or haven you tried? Just add the job to the scheduler. And check your jobClass "BatchFileCollector". Is it really part of the Default package? And you should give the Job a name and a group and reference it from the Trigger... I'll append an example.
oeogijjowefi