教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Jsp  >  正文 解决jsp struts2 修改配置文件的默认位置时报异常的问题

解决jsp struts2 修改配置文件的默认位置时报异常的问题

发布时间:2015-09-24   编辑:jiaochengji.com
本文介绍下,struts2修改配置文件的默认位置时报异常,应该如何解决这个问题呢?本文给出一种解决方法,有需要的朋友,可以参考下。

异常信息:
 

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是默认配置文件,一些必须的框架参数都默认设置在此。

希望以上的方法,可以帮助大家介绍struts2中修改配置文件的问题哦。

您可能感兴趣的文章:

[关闭]
~ ~