java apache-tomcat 7.0 不解压 .war?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15295316/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 19:08:02  来源:igfitidea点击:

apache-tomcat 7.0 does not unpack .war?

javatomcat

提问by MouJian

I want to deploy my app to the server, and then I can visit the app like this:

我想将我的应用程序部署到服务器,然后我可以像这样访问该应用程序:

http://10.10.10.10/index.jsp

but not

但不是

http://10.10.10.10/bar/index.jsp

so this is my host configuration in server.xml:

所以这是我在 server.xml 中的主机配置:

   <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Context docBase="/home/foo/bar.war" reloadable="false" path=""/>
   </Host>

But, after I start up tomcat

但是,在我启动tomcat之后

sh $CATALINA_HOME/bin/startup.sh

sh $CATALINA_HOME/bin/startup.sh

I found that tomcat does not unpack the war file in $CATALINA_HOME/webapps. then I try to delete all files in $CATALINA_HOME/webapps/ROOT, but it does not matter. so is there someone come cross this issue before? and how to solve the probelm?

我发现 tomcat 没有解压 $CATALINA_HOME/webapps 中的 war 文件。然后我尝试删除 $CATALINA_HOME/webapps/ROOT 中的所有文件,但没关系。那么之前有人遇到过这个问题吗?以及如何解决问题?

回答by Mark Thomas

Tomcat 7 does not unpack WAR files from outside the Host's appBase into the appBase.

Tomcat 7 不会将主机 appBase 外部的 WAR 文件解压到 appBase 中。

Tomcat 7 will run your application from the WAR.

Tomcat 7 将从 WAR 运行您的应用程序。