Hello,
I'm trying to set up clustered scheduling with Quartz 1.6.6 with Spring and Weblogic. For some reason the scheduler is not working: in the application's logs, I have enabled debug logging and the job in question is not writing any debug information to the logs when it used to previously. I have found no error messages in any log that I can find.
I previously used a MethodInvokingJobDetailFactoryBean to do the scheduling but due to errors raised when introducing a quartz.properties file, I've had to use another approach.
My Spring application context looks like this:
Code:
<!-- myService is the Java class I'd like to run -->
<bean name="myJob" class="package.MyJob">
<property name="service" ref="myService"/>
</bean>
<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="package.GenericQuartzJob" />
<property name="jobDataAsMap">
<map>
<entry key="batchProcessorName" value="myJob" />
</map>
</property>
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="jobDetail" />
<property name="startDelay" value="60000" />
<property name="repeatInterval" value="60000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="simpleTrigger" />
</list>
</property>
<property name="applicationContextSchedulerContextKey">
<value>applicationContext</value>
</property>
</bean>
The MyJob class implements Runnable, stores the service object as an instance variable and has this method:
Code:
public void run() {
this.service.myMethod();
}
The GenericQuartzJob extends QuartzJobBean and has this method:
Code:
@Override
protected void executeInternal(final JobExecutionContext jobExecutionContext)
throws JobExecutionException {
try {
SchedulerContext schedulerContext = jobExecutionContext
.getScheduler().getContext();
ApplicationContext applicationContext = (ApplicationContext) schedulerContext
.get("applicationContext");
Runnable processToRun = (Runnable) applicationContext
.getBean(this.batchProcessorName);
processToRun.run();
} catch (Exception exception) {
throw new JobExecutionException("Unable to execute job: "
+ this.batchProcessorName, exception);
}
}
The quartz.properties file is added to the EAR file under WEB-INF/classes:
org.quartz.scheduler.instanceId=AUTO
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=1
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.isClustered=true
... and also includes connection details to the database I'm using. I have queried the database tables and it looks like the job is being run as the TIMES_TRIGGERED value for "simpleTrigger" in qrtz_simple_triggers is being incremented.
Thanks in advance for any assistance.