maven整合struts2,spring报错:No mapping found for dependency

J2EE 码拜 9年前 (2015-04-16) 1189次浏览 0个评论
 

具体异常信息如下:
严重: Exception starting filter struts2
java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=com.opensymphony.xwork2.factory.ValidatorFactory, name=””default””] in public void com.opensymphony.xwork2.ObjectFactory.setValidatorFactory(com.opensymphony.xwork2.factory.ValidatorFactory). – Class: com.opensymphony.xwork2.inject.ContainerBuilder$4
File: ContainerBuilder.java

查了网上很多资料,都说是web.xml中少了struts-default.xml,struts-plugin.xml
<!– struts2 config –>
….
<param-value>struts-default.xml,struts-plugin.xml,struts.xml</param-value>

可是加了struts-default.xml,struts-plugin.xml还是同样错误,什么原因?我的struts.xml就放在src/main/resources路径下

maven整合struts2,spring报错:No mapping found for dependency
10分
配置一个

	<filter>
		<filter-name>struts-cleanup</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.ActionContextCleanUp
		</filter-class>
	</filter>

看看。放在最前面。

maven整合struts2,spring报错:No mapping found for dependency
90分
既然不是你说的那个问题,我在网上搜了下,搜到一下三点,你可以试试

1.可以尝试找出xml的默认值,看看究竟默认是什么名字,然后加上这一项配置就行。
2.检查一下jar,是否按照要求导入了,这个可以上网搜索。
3.换个版本的Strust2试试,建议2.1.6

maven整合struts2,spring报错:No mapping found for dependency
引用 3 楼 shijing266 的回复:

既然不是你说的那个问题,我在网上搜了下,搜到一下三点,你可以试试

1.可以尝试找出xml的默认值,看看究竟默认是什么名字,然后加上这一项配置就行。
2.检查一下jar,是否按照要求导入了,这个可以上网搜索。
3.换个版本的Strust2试试,建议2.1.6

换了你说的struts 2.1.6以后,在把 <param-value >struts-default.xml,struts-plugin.xml,resources/struts.xml </param-value >加上resources路径问题解决了,非常感谢

maven整合struts2,spring报错:No mapping found for dependency
引用 4 楼 halfsuccess 的回复:
Quote: 引用 3 楼 shijing266 的回复:

既然不是你说的那个问题,我在网上搜了下,搜到一下三点,你可以试试

1.可以尝试找出xml的默认值,看看究竟默认是什么名字,然后加上这一项配置就行。
2.检查一下jar,是否按照要求导入了,这个可以上网搜索。
3.换个版本的Strust2试试,建议2.1.6

换了你说的struts 2.1.6以后,在把 <param-value >struts-default.xml,struts-plugin.xml,resources/struts.xml </param-value >加上resources路径问题解决了,非常感谢

恩,有用就好…


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明maven整合struts2,spring报错:No mapping found for dependency
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!