[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: Carrot  XML
Profile for Carrot -> Messages posted by Carrot [14]
Author Message
Seemingly fixed: it was more to do with the reliance on inconsistent logging messages to suggest inconsistent trigger times than Quartz.
I have upgraded to 1.8.6 and an seeing the same problem.

gyan10 wrote:
Just to suggest 1.6.6 is very old version. You should go with latest version. 

Unfortunately, I cannot. My application uses Spring, which is only compatible with Quartz version 1.8.
One thing I have noticed is that the database tables are being updated every minute as if the job is running each 60 seconds but I'm not seeing the logs being updated (logged from the QuartzJobBean's executeInternal() method).
I have a couple of Java applications that utilise Quartz 1.6.6 upon Weblogic with Spring (one uses Spring v. 2.5.4; the other uses Spring v. 3.1.1). My architecture has two application servers in the Weblogic cluster.

Both applications have simple triggers set up (using org.springframework.scheduling.quartz.SchedulerFactoryBean, org.springframework.scheduling.quartz.SimpleTriggerBean and org.springframework.scheduling.quartz.JobDetailBean). They are all set to run every 60 seconds.

I have added logging to the associated org.springframework.scheduling.quartz.QuartzJobBean (at the start of the executeInternal() method) which writes the time of when the process gets executed.

What I have found is that the time is inconsistent - sometimes the execution for a given minute will not happen. Examples:

Application 1 has one trigger process which was executed at the following times:

14:26:26,098
14:28:26,089
14:31:26,096
14:33:26,093
14:35:26,095
14:36:26,098
14:38:26,103

Application 2 has two trigger processes which were executed at the following times:

14:40:05,951 (trigger 1)
14:41:05,951 (trigger 2)
14:42:05,943 (trigger 1)
14:43:05,954 (trigger 2)
14:44:05,937 (trigger 1)
14:45:05,956 (trigger 2)
14:46:05,953 (trigger 2)
14:47:05,937 (trigger 1)
14:48:05,941 (trigger 1)
14:49:05,939 (trigger 1)
14:50:05,951 (trigger 2)

If I switch one Weblogic application server off, then both applications quite happily run all their jobs each and every minute.

I have checked the database tables for all the jobs and QRTZ_SIMPLE_TRIGGERS.REPEAT_INTERVAL is correct (60,000 milliseconds). The difference between QRTZ_TRIGGERS.PREV_FIRE_TIME and QRTZ_TRIGGERS.NEXT_FIRE_TIME is also 60,000.

My quartzProperties definition in the application context file looks like this:

Code:
 <property name="quartzProperties">
     <props>
         <prop key="org.quartz.scheduler.instanceName">MyClusteredScheduler</prop>
         <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
         <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
         <prop key="org.quartz.threadPool.threadCount">15</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.clusterCheckinInterval">5000</prop>
         <prop key="org.quartz.jobStore.dataSource">myDS</prop>
         <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
         <prop key="org.quartz.dataSource.myDS.driver">oracle.jdbc.driver.OracleDriver</prop>
         <prop key="org.quartz.dataSource.myDS.URL">{db connection string}</prop>
         <prop key="org.quartz.dataSource.myDS.user">{user}</prop>
         <prop key="org.quartz.dataSource.myDS.password">{password}</prop>
         <prop key="org.quartz.dataSource.myDS.maxConnections">5</prop>
         <prop key="org.quartz.dataSource.myDS.validationQuery">select 0 from dual</prop>
     </props>
 </property>
 


Any thoughts upon why this should be? Thanks in advance.
Have fixed this.

1) quartz.properties was not being picked up in my application, even though it was in WEB-INF/classes. No idea why this should be. Had to include the properties within the SchedulerFactoryBean definition within my application context XML file instead.
2) org.quartz.jobStore.tablePrefix wasn't working - any value other than QRTZ_ brings up a database integrity check error when the application starts. The only way I could get around this issue was to create two separate database users, both of which had the tables created with the QRTZ_ prefix.
Also, can someone confirm what changes I would need if I wanted to include a second (different) Java app upon the same Weblogic server, which also has its own trigger processes? Does this other application need an exact copy of the quartz.properties file? Should it point to a different set of database tables? Should I be specifying a different instance name?

I'm confused as to what is meant by "If you are using the clustering features, you must use the same name for every instance in the cluster that is 'logically' the same Scheduler" in the documentation.

Thanks.
Hello,

I have a Java application which utilises Quartz 1.6.6. It is deployed onto Weblogic, the architecture of which includes two application servers.

The application includes a trigger process which runs regularly - once a minute. This is achieved using Spring (org.springframework.scheduling.quartz.SchedulerFactoryBean).

I have included a quartz.properties file in the Java application's EAR file with a hope to be able to utilise Quartz's clustering facilities so that the application servers would synchronise themselves in order that the job is only run once per minute. However, on looking at the application log, it's obvious to see that from the messages produced, there are still two jobs being run every 60 seconds - one a few seconds behind the other.

Examples of times this afternoon that the job has run:

15:10:46,984
15:10:49,583
15:11:46,961
15:11:49,561

Here's the properties file:

Code:
 org.quartz.scheduler.instanceName=QuartzClusteredScheduler
 org.quartz.scheduler.instanceId=AUTO
 
 org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
 org.quartz.threadPool.threadCount=5
 
 org.quartz.dataSource.dbDS.driver=oracle.jdbc.driver.OracleDriver
 org.quartz.dataSource.dbDS.URL=jdbc:oracle:thin:@MY_DB:1521:my_sid
 org.quartz.dataSource.dbDS.user=username
 org.quartz.dataSource.dbDS.password=password
 
 org.quartz.dataSource.dbDS.maxConnections=5
 
 org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
 org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
 
 org.quartz.jobStore.isClustered=true
 org.quartz.jobStore.dataSource=dbDS
 org.quartz.jobStore.tablePrefix=QRTZ_
 


I have had a look in the database but there is no data at all in the Quartz tables, which would lead me to think that the properties file isn't being picked up. I have included quartz.properties in the EAR file under WEB-INF/classes in the WAR.

Am I doing anything wrong?

Thanks in advance for any assistance.

gyan10 wrote:
If you have quartz-all-1.6.6.jar in your classpath, no other jar is required to add but if you have quartz-1.6.6.jar in this case you need to add either one of them. 

My application has quartz-1.6.6.jar. What do you mean by "you need to add either one of them"?

Thanks.
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.
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.
Hello,

I'm trying to get Quartz cluster-aware scheduling (v. 1.6.6) on my installation of Weblogic.

I have added the quartz.properties file to my application's EAR file. When I try and deploy the application, I get the following:

Code:
NoSuchDelegateException: Couldn't load delegate class: org.quartz.impl.jdbcjobstore.oracle.OracleDelegate


The properties file includes this line - taken from the example in the documentation upon this site - as I am connecting to an Oracle database to access the tables that Quartz uses:

Code:
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate


I have checked the Quartz 1.6.6 jar and the OracleDelegate class does not exist in org.quartz.impl.jdbcjobstore - in fact, the oracle package does not exist at all.

Does anyone have any suggestions as to how I fix this problem? Can I use any alternative classes I could utilise instead? Thanks in advance for any assistance.

Carrot wrote:
I've tried to find instructions for how to install the tables in the database but have not succeeded. Can anyone point me to the appropriate documentation, please? 

Mea culpa - it's detailed within tutorial 9 (http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/TutorialLesson09).
Hello,

I've been tasked with setting up clustering with Quartz. The version I'm using is 1.6.6.

I've looked at the documentation under version 1.x (http://quartz-scheduler.org/documentation/quartz-1.x/quick-start) and found that in order to get the clustering working, I need to create a JDBC-JobStore. For this to work, tables need to be created in the database by Quartz.

I've tried to find instructions for how to install the tables in the database but have not succeeded. Can anyone point me to the appropriate documentation, please?

Thanks for any assistance.
 
Profile for Carrot -> Messages posted by Carrot [14]
Go to:   
Powered by JForum 2.1.7 © JForum Team