views:

161

answers:

2

Greetings,

I'm looking for a good solution for externalizing the JNDI connection pool information in context.xml of a war so that as the application moves from dev to QA to prod, the war file won't need to be recompiled. Ideally the url, driver, username and password would be variablized and then populated by means of a properties file that would customized for each environment. If this isn't possible, are there other suggestions on how to handle moving a war across environments without recompiling for a target environment? Maven provides profiles this requires a build targeted at a specific environment.

Thanks in advance.

+4  A: 

Why don't you just configure this at the Tomcat level instead of embedding a context.xml? To me, this makes particularly sense since Dev, QA, Prod can use different pool settings. And by this, I mean the configuration/sizing of the pool, not only not only the url, username and password.

Pascal Thivent
By at "the Tomcat level" do you mean in GlobalNamingResources?
biru
In `$CATALINA_BASE/conf/context.xml` or `$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default` or in an individual file in `$CATALINA_BASE/conf/[enginename]/[hostname]/` as documented in http://tomcat.apache.org/tomcat-6.0-doc/config/context.html.
Pascal Thivent
+2  A: 

You can have a context.xml that lives outside the WAR files in the common "conf" directory. See the docs.

Dan