2008-7-2 15:24:58 org.apache.catalina.core.StandardContext start
嚴重: Error filterStart
2008-7-2 15:24:58 org.apache.catalina.core.StandardContext start
嚴重: Context [/struts2] startup failed due to previous errors
在用tomcat開發struts2.0整合spring時,也許一不小心就會出現上面的錯誤
我自己對struts2.0也是剛剛接觸一點點,我自己總結了點
1.struts2.0整合spring時默認的spring配置文件應該放在web-inf/下,否則就要在web.xml中進行如下配置,比如有多個配置文件
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
</context-param>
其中struts.xml中的
<constant name="struts.objectFactory" value="spring" />你可以加入也可以不加入
因為其實當你加入struts2-spring-plugin-2.0.11.1.jar 這個文件的時候里面有個
struts-plugin.xml中已經有了
struts2-spring-plugin-2.0.11.1.jar 是引起Error filterStart的主要原因,需要在項目中加入此JAR包
此外我自己還發現另一個引起該錯誤的原因
比如
你有多個struts2的配置文件,在struts.xml中有有這樣的
<include file="struts-jfreechart.xml" />
包含語句
則在對應的配置文件中的<package name="action" extends="struts-default">
中的name屬性不能與其他的配置文件中的name重復,重復則會出現上面的錯誤!