Announcement Announcement Module
No announcement yet.
Quartz - Tomcat multiple/duplicate job executions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz - Tomcat multiple/duplicate job executions


    Not sure if this should go here or in some Tomcat forum. Apologies if it's not the right place.

    I have a Tomcat 6.0.14 hosting 2 applications. Both are using Spring.
    One of the two is using Quartz through Spring.
    Quartz version is 1.5.0.

    Now depending on the Host configuration the jobs are executed various times.
    I've been testing various configs in Tomcat and these are my findings.

    1 Host elements (the one using Quartz)
    0 Context elements 1 job execution

    1 Host elements (the one using Quartz)
    1 Context elements 2 job executions

    2 Host elements
    1 Context elements 2 job executions

    2 Host elements
    2 Context elements 3 job executions

    I don't know how exactly to interpret this or troubleshoot this problem. Has anyone had a similar problem.
    I'm using the default quartz configuration that comes with the quartz jar.
    I can post config files if needed.

    Any help appreciated.

  • #2
    Quartz Scheduler is being started multiple times

    After checking the logs I found this line QuartzScheduler.start(399) is being printed twice or three times etc. depending on the virtual hosts configuration

    Adding autoDeploy="false" deployOnStartup="false" to the host
    element will solve this. Values are true by default.

    Why is this happening in the first place though...?


    • #3
      Tomcat issue

      After reading more of Tomcat's documentation it seems this is a Tomcat specific on how it deploys applications.

      For reference:


      • #4
        Tomcat and Quartz dupliacte jobs

        I had same problem and followed your suggestions. However, I still have same issue.

        Appreaciate your help.

        Here are my configurations:

        <bean id="commandCenterIncidentUpdate" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="updateCCIncident" />

        <property name="targetMethod" value="updateCCIncidents" />

        <property name="concurrent" value="false" />

        <bean id="updateCCIncident" class="scheduling.UpdateCCIncidents">

        <property name="cprService">

        <ref bean="CPRService" />


        <bean id="cronIncidentUpdateTrigger"

        class="org.springframework.scheduling.quartz.CronT riggerBean">

        <property name="jobDetail" ref="commandCenterIncidentUpdate"/>

        <property name="cronExpression" value="0 0,15,30,45, * * * ?" />

        <bean id="quartzShedulerFactoryBean" class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">

        <property name="triggers">


        <ref bean="cronIncidentUpdateTrigger" />



        <property name="applicationContextShedulerContextKey" value="applicationContext"/>

        <property name="waitForJobsToCompleteOnShutdown" value="true"/>


        <Host name="localhost" appBase="webapps"

        unpackWARs="true" autoDeploy="false"


        xmlValidation="false" xmlNamespaceAware="false">


        • #5

          Unfortunately I don't have access to those configuration files any longer since
          it's an old company I worked for.
          Best thing is to check the Tomcat documentation. I hope the link I've posted
          in this thread will help.



          • #6

            Thanks. I fxed the problem. The problem is we load applicationContext three times due to wrong Spriing configuration.



            • #7
              multiple applicationContexts in tomcat app


              I'm seeing the same problem that spring context is being loaded twice in tomcat and cannot figure out what is causing it. For example i see two sets of quartz threadpool. Can someone please point me to where to look into?



              • #8
                this had something to do with the autodeploy feature of tomcat if I remember well, have a look there. There are to properties that I've changed but it's been ages, one of the them was autodeploy and the other something to do with war deployment. Both in the tomcat config. If you find a solution please post it. This thread seems to be getting resurrected once in a while....


                • #9
                  Well, I played with autoDeploy and deployOnStartUp and nothing helped. What seems to be happening is that tomcat starts up and i can see that there is one instance of my app alive, as soon as i access the app (through its context "/foo") then suddenly the second instance pops up and I fail to see why the first or the second would/should be there in the first place. i have not configure the ROOT instance at all, otherwise i would have said that i'm having these instances one for "/" and one for "/foo" context.


                  • #10
                    OK, for the ones that are having the problem i was having, this was my solution thanks to Alistair's blog: