2012-04-06

Application is deployed on Tomcat6 on context path "/environame/appname".

But I cannot access my application using following URL:

http://localhost:8080/environame/appname

I have to use underscore instead of slash between "environame" and "appname".

http://localhost:8080/environame_appname

Tomcat 5 works differently.

In case of Tomcat 5 there will not be underscore in the URL:

http://localhost:8080/environame/appname

What should I change in configuration of my application or Tomcat 6 to access my application using slash instead of underscore between "environame" and "appname"?

UPDATE:

path The context path of this web application, which is matched against the beginning of each request URI to select the appropriate
web application for processing. All of the context paths within a
particular Host must be unique. If you specify a context path of an
empty string (""), you are defining the default web application for
this Host, which will process all requests not assigned to other
Contexts.

The value of this field must not be set except when statically
defining a Context in server.xml, as it will be inferred from the
filenames used for either the .xml context file or the docBase.

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

We store context xml file to $CATALINA_HOME/conf/Catalina/localhost/environame_appname.xml file.
Tomcat 5.0.28 uses path attribute of Context element.

Tomcat 6 uses name of context xml file.

Is it possible to change configuration to use path attribute instead of the name of the xontext xml file?

ANSWER:

There is a bug bug#46713

If a path attribute is set inside the context tag in context xml's it
is ignored. Instead the path is set to "/" + . While it nice that even pathes with '/' can
be encoded in the file name by replacing '/' with '#' it is very
confusing that an existing path attribute is simply ignored.

So, I need just rename my context xml file to environame#appname.xml.

Show more