We have a tomcat deployment where we're deploying a war called app.war
. In the /opt/tomcat/webapps
directory you see:
/opt/tomcat/webapps/foo.war
/opt/tomcat/webapps/foo
/opt/tomcat/webapps/host-manager
/opt/tomcat/webapps/jmx-console
...
You can see that Tomcat deployed foo.war
into the foo
directory.
I thought if we put a new foo.war
in the webapps
directory, Tomcat checks to see if this was changed, remove the old foo
directory, and unwar foo.war
into foo
.
We have an automated deployment script that failed, the deployment script shutdown Tomcat, copied foo.war
to /opt/tomcat/webapps
and restarted Tomcat. However, Tomcat never replaced the /opt/tomcat/webapps/foo
directory with the contents of the new foo.war
. Manually deleting /opt/tomcat/webapps/foo
allowed Tomcat to create a new foo
directory with all of the new files in it.
The deployment script was suppose to delete /opt/tomcatwebapps/foo
but due to an error in the script that didn't happen. We've now fixed the bug. However, the script had been used before in deployments, and we never had this issue, so I assume that Tomcat was able to detect the changes ands deploy the new foo.war
.
So, does Tomcat detect when a war file was changed. If so, how does it do this? The deployment script touches the war file to update the timestamp to help in this detection, so it couldn't be a timestamp issue.
$CATALINA_BASE/conf/Catalina/localhost
. This is sometimes updated. Also, the war contains configuration files that differ from server to server. We have to explode the war and change those files. I've always thought the process was way more complicated than necessary. – David W.