Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

my existing conf/context.xml file has already a element; WEB-INF/web.xml

I would like to add another to allow localhost access to the /manager/status location to my monitoring, however adding a new Context element like so;


<Context path="/manager" privileged="true"
         <Valve className="org.apache.catalina.valves.RemoteAddrValve"

breaks the xml, as I presume that file needs a single root element to lint/parse ok SEVERE: Parse Fatal Error at line 6 column 2: The markup in the document following the root element must be well-formed.

org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
share|improve this question
up vote 2 down vote accepted

The details in the context.xml file are used for all contexts. If you want to specify specific details for one particular context create a file with a context tag in $CATALINA_BASE/conf/[enginename]/[hostname]/

eg. conf/catalina/localhost/manager.xml that contains:

<Context privileged="true"
         <Valve className="org.apache.catalina.valves.RemoteAddrValve"

note that we don't need the path as the file is called manager.xml

read this for more details:

share|improve this answer
I get a 401 if I call manager/status from localhost and a 403 if I call from some other host... so it looks like manager/status still wants Basic authentication – Tom H Sep 3 '10 at 18:23

For Tomcat 5, unlike Tomcat 4.x, it is NOT recommended to place elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat.

Context elements may be explicitly defined:

In the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps. In the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host. In individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. foo#bar.xml for a context path of /foo/bar. The default web application may be defined by using a file called ROOT.xml. Only if a context file does not exist for the application in the $CATALINA_HOME/conf/[enginename]/[hostname]/; in an individual file at /META-INF/context.xml inside the application files. If the web application is packaged as a WAR then /META-INF/context.xml will be copied to $CATALINA_HOME/conf/[enginename]/[hostname]/ and renamed to match the application's context path. Once this file exists, it will not be replaced if a new WAR with a newer /META-INF/context.xml is placed in the host's appBase. inside a Host element in the main conf/server.xml

With the exception of server.xml, files that define Context elements may only define a single Context element.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.