1. 程式人生 > >com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$Mis

com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$Mis

org struts2 value mod spa mave ppi open and

為什麽會出現這個錯誤?

我使用了Maven配置Struts,所以改動Struts配置文件的默認路徑,例如以下:

<!-- 配置struts -->
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
		<init-param>
			<param-name>config</param-name>
			<param-value>../../resources/struts.xml</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.cgi</url-pattern>
	</filter-mapping>

因為不是默認錄了, 一些框架須要的參數無法載入。

解決的方法:

改動

<param-value>../../resources/struts.xml</param-value>為
<param-value>struts-default.xml,struts-plugin.xml,../../resources/struts.xml</param-value>
struts-default.xml(必須),struts-plugin.xml(可選)

com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$Mis