File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Persistent values in Tomcat 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Persistent values in Tomcat 7" Watch "Persistent values in Tomcat 7" New topic

Persistent values in Tomcat 7

Mads Jurik

Joined: Jul 21, 2011
Posts: 2
I am trying to develop and deploy a WAR application for Tomcat 7. The application needs to talk to a server. I have configured this by having default server host and port as properties in the META-INF/context.xml file, which I access from the application without any problems.

Multiple people will be deploying this WAR and I would like to have an easy way for them to replace the values in the META-INF/context.xml file and preferably not having to redo this each time the application is redeployed. From what I understood you can overwrite the values with the values in the conf/Catalina/Localhost/<appname>.xml file. But here all my problems started.

First I tried to add the copyXML="true" to the Host in the conf/server.xml and the context.xml was copied as expected, then I changed the values, and the application restarted with the new values, so far so good. But when I redeployed (by overwriting the WAR file in the webapps directory) the context.xml from the newly deployed WAR file had overwritten the modified one in conf/Catalina/Localhost.

Next I removed the copyXML="true" (thinking that strictly I didn't need it now I had the file copied), but after a redeploy Tomcat deleted the file in conf/Catalina/Localhost, and even worse, when the copyXML is not set, it seems that the application is ignoring the values in the conf/Catalina/Localhost/<appname>.xml completely.

Anyone know what I am doing wrong?
(I'm running Tomcat 7.0.16 on an JDK 1.6.0_22-b04)

The content of the context.xml:

Mads Jurik

Joined: Jul 21, 2011
Posts: 2
Problem was an override="true" had been lost in the process somewhere.
I agree. Here's the link:
subject: Persistent values in Tomcat 7
It's not a secret anymore!