tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Convenient web application configuration.
Date Sat, 01 Nov 2008 21:00:55 GMT

"Jason Cipriani" <jason.cipriani@gmail.com> wrote in message 
news:c09049bf0810300323q3d7df8fcs80c407eefea14472@mail.gmail.com...
> I'm using Tomcat 6.0.18 on Windows XP SP3, Windows Server 2003, and
> Windows Vista (UAC disabled).
>
> 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.
>
> My problem is that web.xml is part of the web application WAR file.
> Also web.xml differs for the 4 different machine the web application
> runs on. This means that every single time I make a release, I have to
> comment and uncomment blocks of parameters in web.xml, build 4
> separate WAR files customized for each machine, and make the 4
> separate WAR files available to each of the 4 people running the web
> application. This is very cumbersome and it seems unreasonably
> complicated, and has already led to a number of distribution mistakes
> on multiple occasions. Is there a better place I can store
> site-specific configuration options? Any suggestions would be helpful.
>

This is specific to Tomcat, but Tomcat will do System variable replacement 
while parsing web.xml.  So you would do something like:
    <init-param>
       <param-name>foobar</param-name>
       <param-value>${myapp.foobar}</param-value>
   </init-param>
Then each of the 4 just have to include a -Dmyapp.foobar=value when starting 
up Tomcat.

> 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?
>
> 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.
>
> Thanks,
> Jason
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 




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


Mime
View raw message