Hi,

I have a need to deploy a single war into the same Tomcat container with two different configurations.

I thought I found a way to do this using Context files that pass in information that can be used to configure the Application Context.

Here is what I attempted, but have failed. This seems like it should work based on a blog I read here.

I used the following Tomcat context files configurations.

Tomcat Context file:
Code:
<Context docBase="C:/path/to/mywarfile.war">
  <Parameter name="deployment" value="DEV" override="false"/>
  <!-- Prevents collisions within tomcat for deploying same war in different configurations -->
  <Parameter name="webAppRootKey" value="dev.root" override="false"/>
</Context>
The 'deployment' parameter should be read by the ServletContextPropertyPlaceholderConfigurer and be made available to the next PropertyPlaceholderConfigurer.

Here are the two beans in question:

Code:
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
	 <!--<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>-->
	<property name="ignoreUnresolvablePlaceholders" value="true" />
	<property name="searchContextAttributes" value="true"/>
	<property name="contextOverride" value="true"/>
</bean>
	
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	<property name="ignoreResourceNotFound" value="true"/>
	<property name="locations">
		<list>
			<value>classpath:config/default.properties</value>
			<value>file:/config/application-${deployment}.properties</value>
		</list>
	</property>
</bean>
However, this doesn't work. I was hoping the first PPC bean would resolve the ${deployment} placeholder that exists in the 2nd PPC bean.

Here's the output I get when I attempt this:

Code:
2010-02-07 15:20:05,009 WARN [PropertyPlaceholderConfigurer] (main) - Could not load properties from URL [file:/config/application-${deployment}.properties]: \config\application-${deployment}.properties (The system cannot find the file specified)
Am I doing something wrong here?

I'm open to another solution. The main goal is to deploy a single war file multiple times into the same Tomcat instance using different configurations.

Thanks in advance for your help.