The quartz timing task in tomcat is executed twice each time

In the past two days, I found that the quartz timed task deployed to tomcat was executed twice each time, but it was not executed when myeclipse was executed. Later, I searched the Internet and found that the problem only occurred on the tomcat server. caused by self-starting.

The cause of this problem is that the server.xml in your tomcat's conf directory has the following configuration


  <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware=" false">

<Context path="" docBase="C:\Program Files\Tomcat 6.0\webapps\XXX\" workDir="C:\Program Files\Tomcat 6.0\webapps\XXX\" />

  where the first line tells tomcat, loads all project project files under webapps at startup, and the second line makes tomcat load it again (generally, the second line is configured, mainly because the project name is removed when the domain name is accessed), In this case, the quartz timing in the project will be triggered twice, executing both sides.



Therefore, the modification method is as follows


<Host name="localhost" appBase=""

            unpackWARs="false" autoDeploy="false"



<Context path="" docBase="C:\Program Files\Tomcat 6.0\webapps\XXX\" workDir="C:\Program Files\Tomcat 6.0\webapps\XXX5xun5mi\" />

put the first line in the appbase is removed, and the autodeploy property value is set to false, so this line does not cause any project items to be loaded.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326895161&siteId=291194637