2015-04-23 37 views
0

我在CentOS 6.2上運行Tomcat 7.0.23。我有一個WAR,我使用服務器特定的上下文XML文件進行部署。Tomcat7 WAR解壓縮不完整

的conf/server.xml中包含:

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

的conf /卡塔利娜/本地主機/ 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文件夾)的工作/卡塔利娜/本地主機/ MyWebapp/文件夾中只包含:

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

Tomcat 7 Host Documentation爲參數unpackWARs說:

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文件的行爲?這是記錄在哪裏?我應該在哪裏放置資源文件?

回答

0

這似乎是Tomcat 7.0.12 - 7.0.47版本中的一個奇怪行爲。 的changelog爲7.0.12版本包含:

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