Tomcat7 WAR解包不完整

时间:2015-04-23 13:36:24

标签: tomcat7 war

我在CentOS 6.2上运行Tomcat 7.0.23。我使用服务器特定的上下文XML文件部署了WAR。

conf / server.xml 包含:

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

conf / Catalina / localhost / MyWebapp.xml 包含:

<Context docBase="/opt/apache-tomcat-7.0.23/MyWebapp.war" unpackWAR="true">

WAR文件包含(我通过解压缩验证它):

css/style.css
META-INF/MANIFEST.MF
META-INF/maven/...
WEB-INF/classes/... (the .class files)
WEB-INF/lib/... (some .jar files)
WEB-INF/resources/...
WEB-INF/web.xml
WEB-INF/log4j.xml

在tomcat中部署时(使用热部署或冷部署,以及先前删除MyWebapp文件夹) work / Catalina / localhost / MyWebapp / 文件夹仅包含:

WEB-INF/classes/...
WEB-INF/lib/...

unpackWARs 参数的Tomcat 7 Host Documentation表示:

Set to true if you want web applications that are placed in the appBase directory as web application archive (WAR) files to be unpacked into a corresponding disk directory structure, false to run such web applications directly from a WAR file.

所以它对实际拆包的内容并不十分具体。

Tomcat没有解压缩整个WAR文件的预期行为吗?这是记录在哪里?我应该在哪里放置资源文件?

1 个答案:

答案 0 :(得分:0)

这似乎是Tomcat版本7.0.12 - 7.0.47中的一种奇怪行为。 版本7.0.12的changelog包含:

Don't unpack WAR files if they are not located in the Host's appBase.

对于版本7.0.48(发布为7.0.50):

Add support for unpacking WARs located outside of the Host's appBase in to the appBase.

有关这些更改的详细信息,请参阅相应的Bugzilla entry