首页 > 代码库 > com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$Mis

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

为什么会出现这个错误?

我使用了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