简体   繁体   中英

issue with tomcat context setting in server.xml

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM