This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I need deploy several instances of the same web application (webapp uses Spring framework 4.0.x) as WARs with different names inside one Tomcat 7 instance. Configuration files are located outside of WAR in $Tomcat/conf/<appname>, path to this directory is located in context config file this way:
In Spring config files I am reading variable "appConfigPath" in a property configurer bean using "java:comp/env" and this works fine.
Now I need use the same variable in web.xml file to define path to log4j.xml.
but Tomcat during deploying / starting the application does not substitute the "variable" to its value.
You don't need to do any param configurations in web.xml since you have setup the environment variable already in the Tomcat context xml. To get to the value of that configured reference, in your servlet code, all you have to do is:
Jaikiran Pai wrote:Tomas, welcome to CodeRanch!
You don't need to do any param configurations in web.xml since you have setup the environment variable already in the Tomcat context xml.
you're right, I could read the param in java code, but I can't because Log4j have to be parameterized earlier than Spring loads the application context. Scenario with configuring Log4j inside the servlet code have been the first solution I have used, but it produces warning.
Using of listener inside the web.xml is the solution, but now I need solve parameterizing the place of Log4j configuration file.