tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Shevett <shev...@homeport.org>
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"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

	<property name="location">
      		<value>classpath:congo.properties</value>
	</property>
</bean>

which loads 'congo.properties' off the classpath. This is working, but I
think Tomcat does not have separate classpaths for each vhost, so I
can't just drop 'congo.properties' 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"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <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}" />
  </bean>

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.

Thanks!

	-d

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


Mime
View raw message