Hello,

I am in the process of upgrading from Tomcat 7.0.54 to 8.0.9 and am running 
into an issue with the location of my exploded war directories.  In Tomcat 7 I 
had a ROOT.xml file in conf/Catalina/<hostname>/ which contained my Context 
with a docBase="../../www.war" parameter.  This was able to reach my www.war 
directory that lived next to my tomcat directory (one directory above 
CATALINA_HOME, two above webapps).

This doesn't work in Tomcat 8, giving an IAE:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component 
[StandardEngine[Catalina].StandardHost[<hostname>].StandardContext[]]
…
Caused by: java.lang.IllegalArgumentException: The main resource set specified 
[/path/to/tomcat/webapps/www.war] is not valid


I stepped through the source code and arrived at 
o.a.c.webresources.StandardRoot.startInternal().  If the docBase is not 
absolute, we append the appBase with the docBase's getName() which returns just 
"the last name in the pathname's name sequence" according the javadocs.

Should this be getPath() instead?  getPath() would return the full relative 
path that when combined with the appBase, the canonical path will be the 
correct path to the application.  Is this a bug or is it intentional and is 
there a better way I should be configuring my context?

I've been testing this in Java 8 but it happens in 7 as well.  Here is my 
current version info if it matters:

Server version: Apache Tomcat/8.0.9
Server built:   Jun 19 2014 01:54:25
Server number:  8.0.9.0
OS Name:        Mac OS X
OS Version:     10.9.3
Architecture:   x86_64
JVM Version:    1.8.0_05-b13
JVM Vendor:     Oracle Corporation


Thanks in advance,

Peter

Reply via email to