views:

41

answers:

1

in my war's META-INF/context.xml I have:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/foobar" docBase="my-long-war-name"/>

I deploy my war to the webapps/ directory and I confirm that my contex.xml is in %CATALINA_HOME%\conf\Catalina\localhost with the name my-long-war-name.xml

Now, instead of accessing my REST service through http:/ /localhost:8080/my-long-war-name/contacts/data tomcat should allow http:/ /localhost:8080/foobar/contacts/data but I can only access my service through the former URL. It's as if it completely ignores the path given above for my web app. I even tried omitting docBase and that didn't work either.

why doesn't this work?! it's supposed to be so basic!

A: 

I don't see why you need the <Context>. I never touch that when deploying to Tomcat, and everything works fine.

Why don't you just make the WAR name foobar, deploy it, and be done with it? You seem to be wedded to this idea in spite of the evidence to the contrary about how basic it is.

duffymo
renaming the war file will remove information from the war file name such as version number which may be helpful to the system adminitrator without having to look inside the war file.
pastafarian
Sounds like a poor solution. The version info ought to be inside the war manifest. And your build system would be a better source for version info than the name of the war.
duffymo