Tomcat – persist tomcat jndi settings

jndi, tomcat

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

Best Solution

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.