[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
SimpleTriggerBean not running  XML
Forum Index -> Quartz
Author Message
Carrot

journeyman

Joined: 07/10/2012 21:05:03
Messages: 14
Offline

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.
Carrot

journeyman

Joined: 07/10/2012 21:05:03
Messages: 14
Offline

Following on from this, I've managed to get a simpler but similar example to work.

Application context file:

Code:
 <bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
   <property name="jobClass" value="package.MyJob" />
   <property name="jobDataAsMap">
     <map>
       <entry key="message" value="Hello world" />
     </map>
   </property>
 </bean>
 
 <bean id="myTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
     <property name="jobDetail" ref="myJob" />
     <property name="startDelay" value="60000" />
     <property name="repeatInterval" value="120000" />
 </bean>
 


... with the MyJob class:

Code:
 @Override
 protected void executeInternal(final JobExecutionContext ctx) throws JobExecutionException {
     LOGGER.warn("[JOB] " + message);
 }
 


This prints out "Hello world" every two minutes to the application's log on the server.

My non-working version isn't much different, so I'm baffled as to why that one isn't working, yet this one is. Any help would be greatly appreciated.
klalithr

consul

Joined: 01/23/2011 10:58:07
Messages: 466
Offline

Your post is over a few months old. Were you able to figure this out. I dont see anything that stands out as odd in your configuration.
The only recommendation I would give you is to move to the latest version of quartz. The version you are using is very old.

Karthik Lalithraj (Terracotta)
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team