leo173
leo173

Reputation: 303

tomcat published two projects under path "webapps/"

I modified the file conf/server.xml like this below

  <Context path="AA" docBase="BB" reloadable="true" />

when I start tomcat from a shell file publish.sh:

#!/bin/bash
#defined
TOMCAT_HOME="/root/software/apache-tomcat-7.0.29"

#start tomcat
cd "$TOMCAT_HOME"/bin
sh startup.sh
echo "tomcat is starting,please try to access $PROJECT console url"

tomcat publish two projects under path "webapps/",AA and BB。And I tracked that BB was published after AA.

If you logged on the terminal , and start tomcat directly in the directory "$TOMCAT_HOME"/bin with command:

>./startup.sh

Only one project "BB" under path "webapps/"。

Who can tell me Why? Thanks!

Upvotes: 0

Views: 54

Answers (1)

Christopher Schultz
Christopher Schultz

Reputation: 20852

You have double-deployed your web application.

How? Well, you put BB.war into webapps/ (which will be auto-deployed to /BB) and then you put <Context path="AA" docbase="BB"> into server.xml which deployed BB.war to /AA. What did you expect?

If you just want your application to be deployed to /AA, then just re-name the WAR file to AA.war and be done with it: take-out the <Context> in server.xml because it's just making your job harder. This is why it's explicitly recommended not to do that.

Upvotes: 0

Related Questions