Monday, December 04, 2006

Using Quartz Scheduler in a cluster

In a previous post, I described how to use Quartz scheduler for scheduling. In this post, I describe the configuration changes required for using Quartz Scheduler with Scheduling. Clustering currently only works with the JDBC-Jobstore (JobStoreTX
or JobStoreCMT). Features include load-balancing and job fail-over (if the JobDetail's "request recovery" flag is set to true). It is important to note that
  • When using clustering on separate machines, make sure that their clocks are synchronized using some form of time-sync service (clocks must be within a second of each other). See
  • Never fire-up a non-clustered instance against the same set of tables that any other instance is running against.
  • Each instance in the cluster should use the same copy of the file.
The following is an example of how to setup clustering. I implemented it as a stand-alone application. The same settings can be used in clusetered environment.
  1. Copy the source code from the example from the quartz example and add the follwing line to the class
    before adding jobDetail to the trigger. This is job failover.
  2. You have to add the following to the file:
    org.quartz.jobStore.isClustered = true
    org.quartz.jobStore.clusterCheckinInterval = 20000
    This sets up quartz for clustering
  3. Each server must have the same copy of the configuration file.
    org.quartz.scheduler.instanceId = AUTO
    To auto-generate instance ids.
  4. Create the data tables by using the sql scripts provided with the quartz download. The scripts are in the quartz\docs\dbTables directory.
When running the example, you can see the changes in DB in the SIMPLE_TRIGGERS and FIRED_TRIGGERS tables. The following is the file that I used. It has to be in the classpath.
# Configure Main Scheduler Properties
org.quartz.scheduler.instanceName = MyClusteredScheduler
org.quartz.scheduler.instanceId = AUTO
# Configure ThreadPool
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.threadPriority = 5
# Configure JobStore
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass =
org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_

org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000

# Configure Datasources
org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@localhost:1521:orcl
org.quartz.dataSource.myDS.user = scott
org.quartz.dataSource.myDS.password = tiger
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual
In order to use the datasources from your application server, change the datasource definition to the following


  1. This comment has been removed by the author.

  2. This article is great. How do I accomplish the same within a Spring application?

  3. This comment has been removed by the author.

  4. hi,

    You have mentioned "load balance" feature of Quartz in a cluster. How do you configure load balancing in Quartz?


  5. I recommend that the max number of connections be either equal to or higher than the threadCount particularly if you have jobs that will interact with a database.

    courtesy of
    akamai technology solutions inc

  6. I running quartz in a cluster with two boxes. In one of them i getting the next message: "This scheduler instance (SchedulerName) is still active but was recovered by another instance in the cluster. This may cause inconsistent behavior".
    After that my jobs start to be executed just in one instance of the cluster.

    I'm using quartz 1.6 and configuration showed in this site. Any suggestion?

  7. Hi Abhi!!

    Does Quartz support Application Server clustering (not DB clustering)? My application is running in an Application Server clustering environment. I can see from the server console saying 'INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.' What can be done if we need to run jobs in App server clustering environment?


  8. Hi Jithesh,
    We are in same positions. The cluster is built with several JBoss nodes. I made Quartz running as a HA singleton on the master node, so it'a running at only 1 place. Think of something similar ;)


  9. Hi,

    Iam facing an issue with quartz schedulers, details below,

    We are using Quartz along with OSWorkflow and WebWork in our J2EE application with Oracle DB support.

    The jobs are storing into the Oracle DB(tables starts with QRTZ_ ) when a action performed in application, for the particular time(Start time and next fire time) the job is not strarting to trigger, the records stay in DB as inserted.

    It is happening for our production environment, hence not able to debug much on this issue.

    In logs I could not find any exceptions about this triggers. I hope the triggers is failing to attempt/start the scheduler.

    Please provide your suggestion on this why the triggers failed to execute for the specified time frame.


  10. Thanks Abhi. Nice article.
    I followed the steps and came accross this error:
    10:56:07,562 ERROR [STDERR] org.quartz.JobPersistenceException: Couldn't store job: ORA-01002: fetch out of sequence
    [See nested exception: java.sql.SQLException: ORA-01002: fetch out of sequence

    I configured the same quartz properties in the spring bean org.springframework.scheduling.quartz.SchedulerFactoryBean. I could not post theXML as it is not allowed here.

    Any ideas to overcome this????

  11. Hi Abhi,
    Can you please send the sample code to my gmail. It will be helpful for me.

  12. Hi,
    i using Quartz with Jboss AS7 cluster. On the properties i have set properties as given in your blog above. Problem is i still see the quartz thread getting invoked only on the HA master node.
    What i need to do make sure that the job execution is clustered?


  13. Hi,
    I too have same issue with Job execution is clustered using weblogic server. How can i implement to run jobs in App server clustering environment?

  14. Hi,

    I am using quartz in cluster env. in local i am using h2 DB and application is running fine in local but in server we are using Oracle DB. At server my application is throwing exception : Registration of jobs and triggers failed: oracle/sql/BLOB?

    Can you give me any pointer regarding the same?

  15. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
    Java Training in Chennai

  16. The cluster failover approach shows how failover for the scheduler happens in case of 1 node failure, but what about clustering of app server instances within one node. I mean we have 1 node, and 3 JBoss server instances are running in a cluster running with the same version of application deployed. If one JVM(JBoss instance) fails while running the scheduler job, how will the next JVM within same node will take over the processing of the scheduler job left by the 1st JVM. Can you help in this regard.

    1. I haven't started using it, i just need to know how it works in case of 1JBoss instance failure on 1 physical machine considering there are 3 JBoss server instances all running the same application JAR or WAR on the same machine.

    2. Each instance would be running on separate JVM, so it doesn't matter if they are on same Machine or different. As long as they point to the same DB, it should work fine.

  17. Great article one. Thank you for sharing with us.

  18. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.
    Java Training in Chennai | Java Training Institute in Chennai

  19. I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. Im fairly positive theyre likely to be informed a great deal of new stuff here than anyone
    Click here:
    angularjs training in bangalore
    Click here:
    angularjs training in pune

  20. Very good brief and this post helped me alot. Say thank you I searching for your facts. Thanks for sharing with us!
    Click here:
    Microsoft azure training in tambaram
    Click here:
    Microsoft azure training in chennai
    Click here:
    Microsoft azure training in annanagar

  21. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Blueprism training in tambaram

    Blueprism training in annanagar

    Blueprism training in velachery

  22. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
    Devops training in velachery
    Devops training in annanagar

  23. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article. thank you for sharing such a great blog with us.
    java training in chennai | java training in bangalore

    java online training | java training in pune

  24. Well done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best! 
    python training institute in marathahalli | python training institute in btm

  25. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    excel advanced excel training in bangalore

  26. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.

    AWS Interview Questions And Answers

    AWS Tutorial |Learn Amazon Web Services Tutorials |AWS Tutorial For Beginners

    AWS Online Training | Online AWS Certification Course - Gangboard

    AWS Training in Toronto| Amazon Web Services Training in Toronto, Canada

  27. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

    Data Science Course in Indira nagar
    Data Science Course in btm layout
    Python course in Kalyan nagar
    Data Science course in Indira nagar
    Data Science Course in Marathahalli
    Data Science Course in BTM Layout

  28. Good Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in chennai

    automation anywhere online Training

    angularjs interview questions and answers

  29. DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

    Good to learn about DevOps at this time.

    devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

  30. Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work

    DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.

    Good to learn about DevOps at this time.

    devops training in chennai | devops training in chennai with placement | devops training in chennai omr | devops training in velachery | devops training in chennai tambaram | devops institutes in chennai | devops certification in chennai | trending technologies list 2018

  31. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    Java training in Chennai

    Java training in Bangalore

  32. Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    machine learning course in Chennai
    machine learning training center in Chennai
    machine learning certification in Chennai
    Android training in chennai
    PMP training in chennai

  33. Such a wonderful blog on Machine learning . Your blog have almost full information about Machine learning .Your content covered full topics of Machine learning that it cover from basic to higher level content of Machine learning . Requesting you to please keep updating the data about Machine learning in upcoming time if there is some addition.
    Thanks and Regards,
    Machine learning tuition in chennai
    Machine learning workshops in chennai
    Machine learning training with certification in chennai

  34. Really useful information. Thank you so much for sharing.It will help everyone.Keep Post. RPA training in chennai | RPA training in Chennai with placement

  35. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    oneplus service centres in chennai
    oneplus service center velachery
    oneplus service center in vadapalani

  36. Appericated the efforts you put in the content of Data Science .The Content provided by you for Data Science is up to date and its explained in very detailed for Data Science like even beginers can able to catch.Requesting you to please keep updating the content on regular basis so the peoples who follwing this content for Data Science can easily gets the updated data.
    Thanks and regards,
    Data Science training in Chennai
    Data Science course in chennai with placement
    Data Science certification in chennai
    Data Science course in Omr

  37. It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Python online training
    uipath online training

  38. uvoffer- OK if you are searching for free unlimted tricks then visit now on and get unlimited offers and informations.
    film ka naam whatsapp puzzle answer film ka naam whatsapp puzzle

  39. My manju - if you want girls mobile numbers then this website is best for you . you can visit on this website and get their information and you also can meet with thrm and go for a date . click here to use our website --- online dating website

  40. Whatscr - many peoples want to join random whatsapp groups . as per your demand we are ready to serve you whatsapp group links . On this website you can join unlimited groups . click and get unlimited whatsapp group links

  41. Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.
    Thanks & Regards,
    VRIT Professionals,
    No.1 Leading Web Designing Training Institute In Chennai.

  42. Thanks for sharing valuable information.It will help everyone.keep Post.

  43. Go Health Science is the best resource to get all kinds of Knowledge about Health and Science updates on Healthy Life ideas.

  44. Get the best nursing services baby care services medical equipment services and allso get the physiotherapist at home in Delhi NCR For more information visit our site

    nursing attendant services in Delhi NCR
    medical equipment services in Delhi NCR
    nursing services in Delhi NCR
    physiotherapist at home in Delhi NCR
    baby care services in Delhi NCR

  45. ขอให้คุณมีความสุขและมีความสุขในสัปดาห์ใหม่กับครอบครัวและคนที่คุณรัก ขอบคุณสำหรับการแบ่งปันบทความ

    Giảo cổ lam hòa bình

    hat methi

    hạt methi

    hạt methi ấn độ


Popular Posts