2008-7-2 15:24:58 org.apache.catalina.core.StandardContext start
嚴(yán)重: Error filterStart
2008-7-2 15:24:58 org.apache.catalina.core.StandardContext start
嚴(yán)重: Context [/struts2] startup failed due to previous errors
在用tomcat開發(fā)struts2.0整合spring時(shí),也許一不小心就會(huì)出現(xiàn)上面的錯(cuò)誤
我自己對(duì)struts2.0也是剛剛接觸一點(diǎn)點(diǎn),我自己總結(jié)了點(diǎn)
1.struts2.0整合spring時(shí)默認(rèn)的spring配置文件應(yīng)該放在web-inf/下,否則就要在web.xml中進(jìn)行如下配置,比如有多個(gè)配置文件
<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" />你可以加入也可以不加入
因?yàn)槠鋵?shí)當(dāng)你加入struts2-spring-plugin-2.0.11.1.jar 這個(gè)文件的時(shí)候里面有個(gè)
struts-plugin.xml中已經(jīng)有了
struts2-spring-plugin-2.0.11.1.jar 是引起Error filterStart的主要原因,需要在項(xiàng)目中加入此JAR包
此外我自己還發(fā)現(xiàn)另一個(gè)引起該錯(cuò)誤的原因
比如
你有多個(gè)struts2的配置文件,在struts.xml中有有這樣的
<include file="struts-jfreechart.xml" />
包含語句
則在對(duì)應(yīng)的配置文件中的<package name="action" extends="struts-default">
中的name屬性不能與其他的配置文件中的name重復(fù),重復(fù)則會(huì)出現(xiàn)上面的錯(cuò)誤!