tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris derham <ch...@derham.me.uk>
Subject Problem with overriding parameters via context.xml
Date Wed, 26 Jan 2011 14:44:24 GMT
All,

I appear to have an issue with tomcat 6.0.30 not allowed web.xml parameters
to be over-ridden via context.xml file entries. This works fine in tomcat
6.0.29.

I have a parameter defined in web.xml, like this

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>WEB-INF/classes/log4j.dev.xml</param-value>
    </context-param>

Then in context.xml I wish to override this parameter in different
deployment environments. So I create a context.xml file in
catalina_base\conf\context.xml containing the following

<?xml version='1.0' encoding='utf-8'?>
<Context>
    <Parameter name="log4jConfigLocation"
value="WEB-INF/classes/log4j.uat.xml" override="false"/>
</Context>

I then have a jsp file that contains the following

<%@ page contentType="text/html; charset=UTF-8" %>
<html>
<body>
<br>log4jConfigLocation is : ${initParam.log4jConfigLocation}
</body>
</html>

Using 6.0.29 the jsp shows the value present in the context.xml file, e.g.
expected behaviour. In 6.0.30 the value from the web.xml file is shown, e.g.
the required override hasn't happened.

I have read the release notes, and can't see anything that jumps out to me
saying that this behaviour has changed. Is this a defect in tomcat, or a
desired change or behaviour? If the latter, can anyone provide any pointers
as to how I can achieve my stated goal? My only current work around is to
revert to 6.0.29

Thanks

Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message