You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mark Lewis <ma...@wingateweb.com> on 2000/11/01 23:58:10 UTC

ContextManager loads incorrectly

I'm not a regular contributor to the devel mailing list, but I tracked
down a problem I've experienced to a quirk (bug?) in the Tomcat 3.2beta6
source code and I thought I would post it here so that the powers that
be can decide whether the code needs to be patched or not.

When loading the ContextManager configuration from the server.xml file,
the work directory may not be correctly loaded.  When the ContextManager
tag has the attributes in this order:

<ContextManager workDir="work" home="/web/staging/tomcat_home"  ... >

The XmlMapper calls ContextManager.setWorkDir() and then
ContextManager.setHome().  The problem is, workDir is supposed to be
based on the 'home' attribute.  Since the setWorkDir() method sets the
workDir as 'home' + param, if setHome() hasn't been called yet the work
directory will not reflect the home attribute.

Note that if you specify the attributes in the opposite order, the
functions are called in the correct order and everybody is happy.

The fix could be either:

1) Store the work dir specified in the config file in ContextManager,
and recalculate the workDir attribute any time home is set.

2) Recalculate workDir everytime you call getWorkDir()    (I believe
this is what Tomcat 3.1 did, so it behaved correctly)

3) Specify that you need to put the "home" attribute first in the
ContextManager XML tag.

Hopefully this is useful, and I wasn't wasting your guys' time. :)

Mark Lewis
mark@wingateweb.com