Unexpected application redeploys on Tomcat
Environment
- JBoss Web Server (JWS) 5.x
- Tomcat 9.0.x
Issue
- We occasionally see applications are unexpectedly redeploy on Tomcat and user's lose their session state as a result.
Resolution
- Set
autoDeployto false in theHostelement of your Tomcatconf/server.xmlto disable the automatic redeployments from file modifications:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false">
- Or identify the source of and stop any unwanted application file modifications prompting the redeployments
Root Cause
- Files monitored under
/webappsorconf/Catalina/are being modified to trigger a redeployment
Diagnostic Steps
- Set the following in your tomcat
conf/logging.propertiesfor additional logging:
org.apache.catalina.startup.HostConfig.level = FINEST
- This will log messages like below indicating the files being monitored for modifications
12-Jul-2022 10:00:29.441 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] redeploy resource /jboss/jws-5.6/tomcat/webapps/docs.war
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] redeploy resource /jboss/jws-5.6/tomcat/webapps/docs
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] redeploy resource /jboss/jws-5.6/tomcat/conf/Catalina/localhost/docs.xml
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] redeploy resource /jboss/jws-5.6/tomcat/webapps/docs/META-INF/context.xml
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] redeploy resource /jboss/jws-5.6/tomcat/conf/context.xml
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] reload resource /jboss/jws-5.6/tomcat/conf/web.xml
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] reload resource /jboss/jws-5.6/tomcat/webapps/docs/WEB-INF/tomcat-web.xml
12-Jul-2022 10:00:29.442 FINE [Catalina-utility-2] org.apache.catalina.startup.HostConfig.checkResources Checking context[/docs] reload resource /jboss/jws-5.6/tomcat/webapps/docs/WEB-INF/web.xml
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.