tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edd Grant <>
Subject Fwd: How do I deploy a war file to a context path not matching the war file name
Date Fri, 01 Feb 2013 10:26:43 GMT
Hi all,

I am using Tomcat 6.0.32 and have a deployment question. I have a war
file over which I do not have control of the filename, let's call it
MYAPP.war . Tomcat's default deployment behaviour would be to deploy
this application under a context of /myapp however I want to deploy it
instead under a context of /somethingelse .

>From reading the documentation I understand that this should be
achievable by configuration of the Context container: I have
tried various things suggested by this documentation but cannot seem
to get anything that works.

In this particular case the application war file does not contain a
META-INF/context.xml file, nor do I have any (simple) means of putting
one in there (I am not the producer of the war file binary). So the
following point from the documentation seemed relevant:

In individual files (with a ".xml" extension) in the
$CATALINA_BASE/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.

As per the statement above and given that I want my context path to be
/somethingelse I have created

The documentation for the docBase (a.k.a context root) attribute
states that the docBase attribute should be used to point to the war
or exploded war file. My server's appBase is the default of 'webapps'
and my WAR and exploded WAR are under webapps so I have specified a
relative path of 'MYAPP' to point to the exploded war folder (i.e.

For clarity, here is the content of the context.xml file:

<?xml version="1.0" encoding="utf-8"?>
<Context docBase="MYAPP">

When I start Tomcat I get the following in the catalina.log

WARNING: A docBase
/usr/local/apache-tomcat-forge-services/webapps/MYAPP inside the host
appBase has been specified, and will be ignored
01-Feb-2013 09:53:30 org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base
/usr/local/apache-tomcat-forge-services/webapps/somethingelse does not
exist or is not a readable directory
        at org.apache.naming.resources.FileDirContext.setDocBase(

It appears as though Tomcat is using the filename (which, as per the
documentation should be used as the context path) as the context root,
and is looking for a path on the filesystem. This seems to contradict
the documentation as far as I can tell?

Also with regard to the warning, I don't understand why this is being
issued but internet wisdom seems to suggest that it can be ignored and
is more of an info than a warning. Is this correct?

I have read and re-read the documentation several times and am a bit
vexed by it at the moment, so would be most grateful for some guidance
on getting this working.

Many thanks,

Edd Grant


Mobile: +44 (0) 7861 394 543

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message