随笔-9  评论-168  文章-266  trackbacks-0
异常:
com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=com.opensymphony.xwork2.ObjectFactory, name='default'] in public void com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.setObjectFactory(com.opensymphony.xwork2.ObjectFactory). - Class: com.opensymphony.xwork2.inject.ContainerImpl File: ContainerImpl.java
解决方法:
  <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>struts-default.xml,struts-plugin.xml,struts2/struts-*.xml</param-value>  
    </init-param>  
 </filter>
即,必须添加
struts-default.xml(必须),struts-plugin.xml(可选)二个额外的配置文件.
原因:
struts-default.xml是默认配置文件,一些必须的框架参数都默认设置在此.
posted on 2011-06-22 15:40 紫蝶∏飛揚↗ 阅读(8951) 评论(3)  编辑  收藏 所属分类: Struts1/2

评论:
# re: struts2 修改配置文件的默认位置报异常的解决方法[未登录] 2011-11-30 23:59 | Tommy
谢谢,帮我解决了一个大问题,支持你!  回复  更多评论
  
# re: struts2 修改配置文件的默认位置报异常的解决方法 2015-06-14 13:42 | 网友
感谢楼主。。我忘记写struts-default。xml了  回复  更多评论
  
# re: struts2 修改配置文件的默认位置报异常的解决方法[未登录] 2016-03-26 15:40 | 淹死的鱼
确实能解决问题,感谢楼主  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: