Jason Cipriani wrote:
> I have a web application with a lot of configuration options, all
> currently stored as servlet initialization parameters in
> WEB-INF/web.xml. The parameters are site specific and are different
> for my development machine, the machines of the two other developers
> working on the project, and the production machine. I am the only
> developer working on the web application.

There's one conceptual issue you'll need to look at, namely
that of separation the environment-dependent configuration
from the environment-independent one. At the first, making the
distinction between the two can be problematic, and there may
well be bordercases - those you'll just need to decide.

With this strategy, I have applications that I can move trhough the
chain from development to testing to production without touching
the .war file contents -- and it's very rare to have a situation
where an application change would require a change in the
environment-dependent configuration.

> Similarly, I have a JDBC data source defined in META-INF/context.xml.
> The data source parameters are different for each machine. Is there
> some other way I can define data sources so that I don't have to
> maintain separate WAR files for each configuration?

Take the context.xml out of the webapp; it wasn't meant to be there.
With Tomcat, conf/Catalina/[hostname]/[appname].xml is a better
place. If there's something you can't place in that file, at least
create a variable in context.xml that does point to the external
resource (file, server, whatever). If you have multiple applications
dependent on some single, poolable resource (common database schema,
for example), it would be better to place the JDBC datasource definition
into server.xml, and put instead a <ResourceLink> element into each
of the per-application context.xml files. That way, you'll have
a single pool serving the various applications (this of course
requires that all the applications play fair and do not leak; a sinlge
leaky application can starve other applications by hogging all
instances of a shared resource.

> Ideally I'd be able to put the settings in context.xml and web.xml
> somewhere outside of the web application directory, and leave them out
> of the web-app's local files, and so they wouldn't have to be packaged
> with the WAR and deploying the WAR wouldn't blow away existing
> configuration data.

web.xml can also be configurable -- but leave there the aspects of
configuration you'd otherwise put as fixed parameters into your
source code, to be determined at compile time.
-- 
..Juha

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to