ABT,
On 4/28/25 9:05 AM, A Name wrote:
We are looking at adding a second instance of our app (named differently --
myappA and myappB) to our Tomcat 9. We currently have the app installed at
a number of customer locations, we are looking at dropping 1 app
Currently, our database connections are established inside the GLOBAL
web.xml in /conf/web.xml - and have been forever. This was a design
decision made long ago - that way the app doesn't have a separate
configuration for each location - it is the same app WAR file, and the
connections are established at the server.
Our customer doesn't want any code changes - is there a way to have some
sort of conditional statements in the web.xml?
No, but maybe you don't need them.
JDBC configurations are never stored in web.xml, regardless of location.
So maybe you are talking about <datasource-ref> or something like that?
Unless your application is collecting some configuration from web.xml
and then making its own connections or establish its own JDBC data
source, your configuration should be in META-INF/context.xml in the web
application. If you don't want to bundle that with your web application,
you can deploy a site-specific configuration file in Tomcat's
conf/[Engine]/[Host]/[appname].xml file which contains this
configuration. Then your web.xml only has to reference the name of the
data-source in datasource-ref which can be static. The local
configuration file gives the details, and web.xml references them.
Will this approach not work for you?
Or if we set it up so Tomcat is hosting 2 sites (www.sitea.com/myapp and
www.siteb.com/myapp) and have the global web.xml with different settings
based on host/site?
As Mark says, "global is global".
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org