tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knute Snortum <kSnor...@catalystitservices.com>
Subject RE: tomcat7-maven-plugin doesn't understand Maven filtering of context files?
Date Tue, 28 Aug 2012 20:53:33 GMT


> -----Original Message-----
> From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com]
> Sent: Tuesday, August 28, 2012 12:02 PM
> To: Tomcat Users List
> Subject: Re: tomcat7-maven-plugin doesn't understand Maven filtering of
> context files?
> 
> 2012/8/28 Knute Snortum <kSnortum@catalystitservices.com>:
> >> >
> >> > "applicationContext.xml" is my Spring context file.  I have
> >> placeholders in it to point to the correct database based on Maven
> >> profiles and filtering.  So a piece of applicationContext.xml looks
> >> like
> >> this:
> >> >
> >> >         <bean id="dataSource"
> >> class="org.apache.commons.dbcp.BasicDataSource"
> >> destroy-method="close">
> >> >                 <property name="driverClassName"
> >> value="${db.driverClassName}" />
> >> >                 <property name="url"             value="${db.url}"
> />
> >> >                 <property name="username"
> >> value="${db.username}" />
> >> >                 <property name="password"
> >> value="${db.password}" />
> >> >                 <property name="maxActive"       value="10" />
> >> >                 <property name="maxIdle"         value="1" />
> >> >         </bean>
> >> >
> >> > As you can see, Tomcat (or Spring?) is finding the dataSource bean
> >> that does not have the placeholders replaced yet.
> >>
> >> Usually it is Spring job to resolve those.
> >>  (It has nothing to to with Tomcat or Maven).
> >>
> >> See
> >> org.springframework.beans.factory.config.PropertyPlaceholderConfigure
> >> r
> >
> > Well, I'm using Maven filtering, but regardless, I thought the whole
> point of the tomcat7-maven-plugin was to run the *war* file, not the
> development (project) files.
> 
> Your question was about "applicationContext.xml". That is an essential
> part of a Spring web application. It is not just a "project" file.
> Now you are changing the topic...

I'm not trying to.  It's the applicationContext.xml file that gets changed by Maven filtering,
then it gets put into the war file by the tomcat plugin.  I want the plugin to run the war
run, not the still in the project with the placeholders.  That's what I thought it did.
 
> Tomcat knows nothing about Spring, and "context" has different meaning
> in Tomcat (referring to the META-INF/context.xml file in a web
> application, see Tomcat Configuration Reference in Tomcat 7
> documentation).
> 
> If you need apply filtering to your data file (that
> "applicationContext.xml" one), shouldn't you configure so explicitly
> somewhere?

I do, and it works perfectly.  It creates my context files with the database data in them
as it should.  These files are built into a war file.  I want the Tomcat plugin to run the
war file.  

When I manually deploy the war file that is created, it works perfectly.  I thought the point
of the Tomcat plugin was that I didn't have to manually deploy the war file.

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


Mime
View raw message