I've noticed that sometimes when I make a change to an existing webapp or 
deploy a new one, that the file contents created in conf/Catalina/localhost do 
not match the contents of the context file in META-INF/context.xml of the 
webapp dir.

Tomcat 6.0.24 - still. Upgrade is coming.

Example, I added a valve to each of my webapps context.xml to turn on the 
access logs.  The valve was the same for each webap, I only changed the name of 
the access log file name.  Three of four webapps produced a log file, but one 
webapp would not produce an access log file, no matter how many times I 
restarted Tomcat - deleted the cache in the work directory and removed previous 
entries in conf/Catalina/localhost.

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
"... You may define as many Context elements as you wish. Each such Context 
MUST have a unique context path. In addition, a Context must be present with a 
context path equal to a zero-length string. This Context becomes the default 
web application for this virtual host, and is used to process all requests that 
do not match any other Context's context path ..."


Contents of the apnxy servlet META-INF/context.xml that keep appearing in 
conf/Catalina/localhost, and I didn't even have the path attribute set in that 
file:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/apnxy">
</Context>


I finally just stopped Tomcat, deleted the cache in work dir, renamed and 
manually copied the apnxy.xml file from META-INF/context.xml to 
conf/Catalina/localhost and started Tomcat.  Access log for apnxy_... appeared. 
 What did I miss?


Contents of each access log valve:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true">
        <!-- Log all requests to Tomcat root -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" 
directory="logs"
        prefix="apnxy_access_log." suffix=".txt" pattern="common" 
resolveHosts="false"/>
</Context>



Contents of context.xml in conf directory:

<?xml version='1.0' encoding='utf-8'?>
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts 
-->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>

Leo


Reply via email to