tags:

views:

170

answers:

2

Hi,

We would like to pass the same WAR thru dev, test, and production. How can we persist our JNDI settings w/o manual modification of server.xml? For example, in Websphere there is an admin console, and the JNDI resources can be added manually and saved, or using jacl/jython script out the addition of the necesary JNDI resources.

Why does tomcat "recommend" to use context.xml? This means we need a separate build for each environment... this is not really JNDI then...it's a glorified JNDI xml property file, since context.xml needs to be bundled in the WAR, and whenever we redeploy (undeploy, deploy, start app) we lose the existing context.xml

+1  A: 

So your actual problem is that you want some webinterface provided by Tomcat to manage the JNDI resources without manually editing the server.xml (which WAS actually also does "under the hood").

Tomcat doesn't ship by default with an admin webinterface like that, only the manager which you already know. I know there are admin tools for Tomcat 5.5.x, you can find it here, unfortunately there's no such tool for Tomcat 6.x. I haven't tried it but you may try to see if it works with Tomcat 6.x as well.

BalusC
Yea...tried it admin with Tomcat6, though it had errors when saving configuration, mbean storeconfig is no longer available...
joshjdevl
A: 

The context.xml doesn't have to be bundled in the war file. You could create a [your app name].xml file containing the Context element for each environment and put it in conf/Catalina/localhost on each server. You don't get an admin interface, but the same war file can be used unchanged in dev, test and production.

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

matt
right, though if I bundle it, that defeats the purpose of JNDI correct? then I will need a separate war file for each environment since my configuration values are different based on environment
joshjdevl
Yes, I've always thought it was odd that the recommended way was to put context.xml inside the war file. I guess that way simplifies the automatic app deployment. I generally go with the `conf\Catalina\localhost\appname.xml` when I can.
matt