Question

I am using tomcat 7.

When I set context different from war file name, everything works fine.

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context docBase="../webapps/abc.war" path="/def" reloadable="true" />
</Host>

But at tomcat startup I see two exploded folder abc and def.

Please help if anybody knows about this issue resolution.

Thanks.

Was it helpful?

Solution

From the Tomcat doc (see "path" attribute):

Even when statically defining a Context in server.xml, [the path] attribute must not be set unless either the docBase is not located under the Host's appBase or both deployOnStartup and autoDeploy are false. If this rule is not followed, double deployment is likely to result.

This is a bit obscur, but my understanding is that you need to use an xml context file to achieve what you are trying to do. How to define a context config file is documented in the above link.

A simpler fix would be to just rename your war file to def.war.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top