wood burning stoves*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
subject: Persistent values in Tomcat 7
Similar Threads
How to configure Tomcat 5.5 for debug mode?
Jboss 5.0 and porting Tomcat projects
Can't write Context element properly
Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver'for connect URL 'jdbc:oracle:oci:@mydbs
Cannot Connect to database using datasource realm