I’m using:
- Tomcat 6.0.30
Here’s my context.xml and web.xml structure in my web application project:
- META-INF
- context.xml
- WEB-INF
- web.xml
When I generate a WAR file for my application, context.xml is being packaged as expected. When I copy the WAR file to the Tomcat webapps folder and start Tomcat, the WAR file is extracted and context.xml is copied to \conf\Catalina\localhost\<webappname>.xml as expected. However, this only works if <webappname>.xml doesn’t already exist. Therefore, I cannot make an update to context.xml, package the WAR, and redploy without first deleting the existing <webappname>.xml. I know this is the intended functionality based on reading the documentation.
My question is, what do I do then? How can I make updates to context.xml and have those updates copied automatically as if they were brand new? I don’t want to have to delete <webappname>.xml before each publish.
Maybe I’m going about this the wrong way?
If you undeploy the application first, the .xml file will be removed from the conf/Catalina/localhost folder. Just dropping a new war in place however does not trigger a undeploy (just a deploy), and the old xml file will not be replaced.
You can undeploy the app by either: