The tomcat 6.0 document at http://tomcat.apache.org/tomcat-6.0-doc/config/context.html says:
Only if a context file does not exist for the application in the
$CATALINA_BASE/conf/[enginename]/[hostname]/
, in an individual file at/META-INF/context.xml
inside the application files. If the web application is packaged as a WAR then/META-INF/context.xml
will be copied to$CATALINA_BASE/conf/[enginename]/[hostname]/
and renamed to match the application's context path. Once this file exists, it will not be replaced if a new WAR with a newer/META-INF/context.xml
is placed in the host's appBase.
However I noticed that if you put new war file in webapp directory, the context.xml
in META-INF
directory replaces context.xml
in $CATALINA_BASE/conf/[enginename]/[hostname]
.
Is there any configuration which makes sure that context.xml
in $CATALINA_BASE/conf/[enginename]/[hostname]/
is not overwritten whenever new war file is deployed.
Edit: I am using autodeploy="true" From the comment of JoseK, I understand when tomcat sees new war file, it undeploys old application (leading to deletion of context file) and deploys the the new war file (leading to creation of new war file). In that case the above information from tomcat document is not relavant. The new question can there be any situation where the above thing can happen?
autoDeploy
attribute set on thehost
element inserver.xml
? Try setting that to false. – matt