TheBuzzSaw
TheBuzzSaw

Reputation: 8826

Is Tomcat redeploying my web app over and over?

My Java web application began experiencing sporadic outages. Peering into the logs, I see this pattern repeated hundreds of times throughout the day.

INFO: Undeploying context [/TheChosenOne]
INFO: Deploying web application archive /var/lib/tomcat/webapps/TheChosenOne.war
INFO: Deployment of web application archive /var/lib/tomcat/webapps/TheChosenOne.war has finished in 323 ms

As far as I know, no human is (purposefully) responsible for this. What would cause this to happen? What triggers a redeployment like this without someone explicitly asking for it? Is this strictly a Tomcat configuration issue? Or can the code itself cause this to happen?

Upvotes: 0

Views: 57

Answers (1)

Mike Adamenko
Mike Adamenko

Reputation: 3002

Tomcat can be configured to check on a regular basis if the files of your application have changed on disk, and redeploy the application if they did. As checking if files have changed is incredibly cpu and memory intensive it is recommend to disable the automatic web application redeployment feature, on production servers which is enabled by default.

Modify it so that it resembles the snippet below:

<host appbase="webapps" autodeploy="false" name="localhost" unpackwars="true" xmlnamespaceaware="false" xmlvalidation="false" />

For more information on autodeploy, see http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Common_Attributes

Upvotes: 1

Related Questions