tags:

views:

84

answers:

1

I have an application that is deployed as ROOT.war under /webapps in Tomcat. As it is configured now, I can only access the application via http://www.example.com. I'd like to be able to access it using http://www.example.com/myapp without having to change the fact that it is deployed as ROOT. I have the following in my ROOT.xml:

<Context path="/myapp"/>

However, when I deploy this ROOT.xml and restart Tomcat and then I try to go to http://www.example.com/myapp, Tomcat gives me a 404. So this tells me that changing this alone will not solve my problem.

Is it possible to configure the ROOT context to be accessed via '/myapp' in this case in Tomcat 6 without having to rename the ROOT context (e.g. without renaming webapps/ROOT.war)?

+1  A: 

You need to rename ROOT.xml to myapp.xml with following content,

<Context docBase="/catalina_home/webapps/ROOT.war" />

By doing this, you create 2 contexts "/" and "/myapp" sharing the same WAR file.

If you just want to have one webapp, the easiest thing to do is to rename ROOT.war into myapp.war.

ZZ Coder
The <Context> you suggested did not work. Looks like I'll need to change the name of the war file. Thanks.
Andy Gherna