tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Shevett <>
Subject Vhost-specific configuration for deployed apps?
Date Wed, 11 Jul 2012 15:12:21 GMT
Hi folks, this has come up in the list archives a couple times, but I'm
having a devil of a time getting it working right.

I'm trying to set a basic set of properties to a deployed app into
Tomcat.  Note that this app is being deployed via the tomcat manager (in
fact it's coming from Jenkins), and is in a VHost.

The problem is I can't find the magic combination to get a couple basic
config params (in this case database connection details) on a per-vhost
basis to be available to the app.

Right now I have a Spring PPC loading properties:
<bean id="propertyPlaceholderConfigurer"

	<property name="location">

which loads '' off the classpath. This is working, but I
think Tomcat does not have separate classpaths for each vhost, so I
can't just drop '' into Catalina/hostname/ and have it
referenced for JUST that vhost, is that correct?

I can't build config parameters into the app, since the app needs to be
generic (a .war file).  I need to pass parameters into the
applicationContext.xml on a per-vhost basis, with the results here:

  <bean id="com.stonekeep.congo.database.Pool"
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>

    <property name="testConnectionOnCheckout" value="true"/>

    <property name="jdbcUrl" value="${congo.jdbcurl}" />
    <property name="user" value="${congo.user}" />
    <property name="password" value="${congo.password}" />

I've thought about using <Context> blocks in the vhost, or in the <Host>
block for the vhost, but I can't figure out the proper mojo to get those
Context parameters into the Spring applicationContext.

My Spring is weak, I do apologize, but would really appreciate any help.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message