Unexpected application redeploys on Tomcat

Solution Verified - Updated

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 autoDeploy to false in the Host element of your Tomcat conf/server.xml to 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 /webappsor conf/Catalina/ are being modified to trigger a redeployment

Diagnostic Steps

  • Set the following in your tomcat conf/logging.properties for 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
Components
Category
Tags

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.