Announcement Announcement Module
Collapse
No announcement yet.
Spring + Quartz + Tomcat = no shutdown Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + Quartz + Tomcat = no shutdown

    Not sure if this is the right forum for this but ...

    I have Spring 1.2.0, the included Quartz jar and Tomcat 5.28 on WinXP. I have configured a task to run using the Quartz scheduler

    Code:
    	<bean id="quartz" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    		<property name="waitForJobsToCompleteOnShutdown"><value>true</value></property>
    		<property name="configLocation"><value>classpath&#58;quartz.properties</value></property>
    		<property name="triggers">
    			<list><ref bean="cronReportTrigger"/></list>
    		</property>
    	</bean>
    quartz.properties ...
    Code:
    org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
    org.quartz.threadPool.threadCount=2
    org.quartz.threadPool.threadPriority=4
    and noticed that Tomcat won't shutdown on command anymore. Neither shutdown script or the eclipse tomcat plug-in work If I look at this in eclipse using the Tomcat plug in I see

    Thread [DestroyJavaVM]
    Thread [Quartz-Scheduler_QuartzSchedulerThread]
    Thread [Quartz-Scheduler_Worker-0]
    Thread [http-8080-Processor3]
    Thread [TP-Processor4]

    all listed as Running after a shutdown.

    I tried setting waitForJobsToCompleteOnShutdown to false (since the job runs for 5 seconds, only once a day) but this made no difference.

    Any one else see this effect?

    ps Tomcat shutsdown fine if I comment out the Quartz stuff.

  • #2
    Re: Spring + Quartz + Tomcat = no shutdown

    I had the same problem. I fixed it by adding
    Code:
    destroy-method="destroy"
    to the SchedulerFactoryBean definition. This way spring closes down the scheduler when the application is stopped.

    Comment


    • #3
      Re: Spring + Quartz + Tomcat = no shutdown

      Originally posted by kdkooter
      I had the same problem. I fixed it by adding
      Code:
      destroy-method="destroy"
      to the SchedulerFactoryBean definition. This way spring closes down the scheduler when the application is stopped.
      Hi, Thanks for the reply, I missed that in the documentation.

      Is this correct?
      Code:
      	<bean id="quartz" 
      		class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
      		destroy-method="destroy"
      	>
      		<property name="waitForJobsToCompleteOnShutdown"><value>true</value></property>
      		<property name="configLocation"><value>classpath&#58;quartz.properties</value></property>
      		<property name="triggers">
      			<list><ref bean="cronReportTrigger"/></list>
      		</property>
      	</bean>
      I tried this but sadly saw no difference.

      Comment


      • #4
        Spring + Quartz + Tomcat = no shutdown

        I have the same Problem as ahumphr decribed above.
        When i try to shutdown tomcat follwing thread are still alive:
        QuartzScheduler_Worker-0
        QuartzScheduler_Worker-1
        QuartzScheduler_QuartzSchedulerThread
        http-processor
        TP-Processor
        DestoryJavaVm

        i can have this problem in IDE and on production server (Windows/Solaris)

        I'm using Spring 1.2.0 and Tomcat 5.0.28

        here my bean configuration:
        <bean id="quartz"
        class="org.springframework.scheduling.quartz.Sched ulerFactoryBean"
        destroy-method="destroy"
        >
        <property name="waitForJobsToCompleteOnShutdown"><value>true </value></property>
        <property name="configLocation"><value>classpath:quartz.prop erties</value></property>
        <property name="triggers">
        <list><ref bean="cronReportTrigger"/></list>
        </property>
        </bean>

        the given destroy-method is not called during shutdown process.
        I hope someone can help
        Regards
        fsamland

        Comment


        • #5
          Have you tried to upgrade to the latest Spring 1.26? It might be fixed there.
          Also you could try a never version of Quartz - it is shipped with Spring (the big .zip file)

          Comment


          • #6
            Spring + Quartz + Tomcat = no shutdown

            Sorry i just recognized that we changed to 1.25
            so thank you for the hint.
            fsamland

            Comment


            • #7
              Here's what worked for me...

              Code:
              <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                  <property name="quartzProperties">
                    <props>
                      <prop key="org.quartz.threadPool.threadCount">1</prop>
                    </props>
                  </property>
                <...

              Comment


              • #8
                This is the same issue as this thread. I posted my solution there as none of the others worked for me.

                http://forum.springsource.org/showth...060#post370060

                Comment

                Working...
                X