1. 程式人生 > >tomcat部署 struts2 File "/struts-tags" not found

tomcat部署 struts2 File "/struts-tags" not found

做Struts2配置時,出了這樣的錯誤.
先前按照
<jsp-config>
<taglib>
<taglib-uri>/struts-tags</taglib-uri>
<taglib-location>/WEB-INF/struts-tags.tld</taglib-location>
</taglib>
</jsp-config>
這種方式把配置訪匯入也沒有用.
查了資料原來是和tomcat配置有關.
以下配置配置在</host>後面
我配置在tomcat server.xml是這樣的
<Host name="bbb" appBase="D:\workspace\webManageSystem\WebContent"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>test.com</Alias>
<Context path="/" docBase="D:\workspace\webManageSystem\WebContent" reloadable="true"
caseSensitive="false" debug="0"></Context>
</Host>

改成以下則成功
    <Host name="bbb" appBase="D:\workspace\webManageSystem\"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>test.com</Alias>
<Context path="/" docBase="WebContent" reloadable="true"
caseSensitive="false" debug="0"></Context>
</Host>

注:以上配置會讓tomcat兩次載入web.xml檔案.如果配置了資料連線池的話,會出現開啟兩倍資料連線池的問題.
所以最好還是改成:
<Host name="webGame" appBase=""
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Alias>127.0.0.1</Alias>
<Context path="/" docBase="E:\workspace0\webGame\WebRoot"reloadable="true"
caseSensitive="false" debug="0"></Context>
</Host>