您的位置:首页 > 编程语言 > Java开发

struts2 修改配置文件的默认位置报异常的解决方法

2012-11-12 10:46 726 查看
异常:

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是默认配置文件,一些必须的框架参数都默认设置在此.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: