I have a web application deployed on tomcat 7. Its context file, named myAppName.xml is located in
$CATALINA_HOME/conf/Catalina/localhost folder.
The problem I'm facing is that on each overwrite or undeploy, my configuration file is deleted from $CATALINA_HOME/conf/Catalina/localhost
folder and I have to copy/paste it from a backup location.
How can I prevent this behavior? I don't want to copy/paste context file everytime I change something in webapp.
What is a Tomcat Context. In Tomcat, the Context Container represents a single web application running within a given instance of Tomcat. A web site is made up of one or more Contexts. For each explicitly configured web application, there should be one context element either in server.
The docBase attribute is a path to the WAR file or exploded deployment directory. It is relative to the webapps directory, although an absolute path can be used. The path attribute is the one we are most interested in, as it defines the context path of the application.
The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file, or a corresponding directory containing the corresponding unpacked contents, as described in the Servlet Specification (version 2.2 or later).
Put it into web/META-INF in the source tree, then Tomcat will copy it out of there into conf/.... on each deploy. Tomcat 7 won't even do that by default, just use it where it is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With