I'm developing a web-based Java application at work and (obviously) have to run it locally during development. I've figured out the Tomcat docs and have a suitable context.xml file in /etc/tomcat6/Catalina/localhost/
but every so often, Tomcat decides to delete it! Which means I have to put it back and restart Tomcat.
Why does it do this? I have searched the Tomcat docs about it and am none the wiser.
(Oh yes: it's not actually called context.xml
but owners.xml
as that's the HTTP path prefix for this application.)
Update
I've now seen Tomcat delete the file whilst Tomcat was running. I think I need to file a bug…
Best Answer
Quick summary: there are several conditions (like changing the war file, deleting the webapp or replacing it with new content) under which tomcat will undeploy the context including removing the context file.
Details: Whether tomcat does or doesn't do autoDeployment (means checking for changes in your .xml descriptor as well as checking changes in the webapp directory) is driven by:
server.xml localted in $CATALINA_HOME/conf/server.xml section:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
You can also set this property in your context file overloading the value
Quoting the doc for cases when autoDeploy=true may cause removal of your context file:
Exhaustive details: http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Automatic%20Application%20Deployment