`
huibin
  • 浏览: 750708 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

Unable to load configuration. Struts2.1.6

阅读更多

Unable to load configuration. Struts2.1.6

[标题]:[转]Struts2.1.6 - Unable to load configuration
[时间]:2009-7-7
[摘 要]:Unable to load configuration. - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
[关键字]:struts、spring、configuration、struts-default、MVC、Apache,框架、SSH
[环境]:Struts2.1.6、JDK6、Tomcat6
[作者]:Winty (wintys@gmail.com) http://www.blogjava.net/wintys

[错误]:
    在Web Project中加入了以下5个Struts2核心jar:
    struts2-core-2.1.6.jar
    xwork-2.1.2.jar
    freemarker-2.3.13.jar
    ognl-2.6.11.jar
    commons-logging-1.0.4.jar
    启动Tomcat时,提示如下错误信息:

2009-7-7 19:55:12 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter MyStruts2
Unable to load configuration. - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load bean: type:com.opensymphony.xwork2.UnknownHandler class:org.apache.struts2.convention.ConventionUnknownHandler - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 30 more
Caused by: Bean type interface com.opensymphony.xwork2.UnknownHandler with the name default has already been loaded by bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-codebehind-plugin-2.1.6.jar!/struts-plugin.xml:29:122 - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206)
    ... 33 more
2009-7-7 19:58:07 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter MyStruts2
Unable to load configuration. - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1105)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1307)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1580)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1560)
    at java.lang.Thread.run(Thread.java:619)
Caused by: Unable to load bean: type:com.opensymphony.xwork2.UnknownHandler class:org.apache.struts2.convention.ConventionUnknownHandler - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 17 more
Caused by: Bean type interface com.opensymphony.xwork2.UnknownHandler with the name default has already been loaded by bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-codebehind-plugin-2.1.6.jar!/struts-plugin.xml:29:122 - bean - jar:file:/F:/Web/homesite/jsp/struts/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206)
    ... 20 more


[原因&解决]:
     这是apache的失误。按照官方文档说明,运行Struts2必须加载5个核心jar包,也就是咱们一开始拷贝的5个jar包,如果你用的是 Struts2之前的版本是没有问题的,但是如果去下载这个新版本,就会报如上错误,因为还需要加载另外两个jar包,可是官方的说明文档没有更新。

    解决方案:在Struts2的解压缩文件夹内的lib文件夹里, 我们找到下列2个jar : commons-fileupload-1.2.1.jar、commons-io-1.3.2.jar,把他们复制到项目根目录下的"WEB- INF"lib"文件夹内。

    既然少了jar,图省事把包struts lib下的jar全都复制到工程目录中。这样做又会出现类似上面的错误提示。所以如非必要,不要加载其它的jar,这大概是struts2.1.6的bug。一般只需加载以下7个jar:

    struts2-core-2.1.6.jar、
    xwork-2.1.2.jar、
    freemarker-2.3.13.jar、
    ognl-2.6.11.jar、
    commons-logging-1.0.4.jar、
    commons-fileupload-1.2.1.jar、
    commons-io-1.3.2.jar


    还有"叶现一"(http://blog.csdn.net/yexianyi/)提供的办法:将struts-2.1.6-all.zip中apps 文件夹中struts2-blank-2.1.6.war文件解压。进入struts2-blank-2.1.6"WEB-INF"lib,只将该文件夹下的9个jar包导入到项目工程中即可,其余的包如果没有用到切不可轻易导入

[参考资料]:
[1] 严重 exception starting filter struts2 unable to load configuration : http://blog.csdn.net/cocohufei/archive/2009/05/13/4176058.aspx
[2] struts2.1.6简单的实例加载struts-default.xml的问题 : http://topic.csdn.net/u/20090212/14/4648539f-e6c1-4a1b-94b9-944712affa96.html
[3] Struts2.x异常- Unable to load configuration..../WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml : http://blog.csdn.net/yexianyi/archive/2009/02/18/3905836.aspx
[4] struts 2.1.6 "Unable to load configuration"异常 : http://blog.csdn.net/thirdprince/archive/2009/04/06/4052027.aspx

分享到:
评论

相关推荐

    struts2.1.6jar all.zip

    这次我们讨论的是Struts2的特定版本——Struts2.1.6的更新内容和使用注意事项。 在描述中提到,之前上传的"struts2.1.6jar all.zip"文件出现了错误,里面包含了Hibernate的内容,而实际上应该是与Struts2相关的文件...

    struts2.1.6-lib

    1. **Struts2 Core**: `struts2.1.6.jar` 是Struts2的核心库,包含了框架的主要组件,如Action、Result、Interceptor等。这个包提供了Action Mapping、请求处理、拦截器链、结果渲染等关键功能。它使得开发者能够...

    struts2.1.6-apps.zip

    Struts2.1.6是Apache Struts框架的一个特定版本,该框架是Java Web开发中的一个强大工具。Struts2以其MVC(Model-View-Controller)架构模式为核心,为开发者提供了一种组织应用程序结构、处理HTTP请求以及管理业务...

    struts2.1.6jar包

    Struts2.1.6是Apache Struts框架的一个版本,它是基于MVC(Model-View-Controller)设计模式的Java Web应用程序开发框架。这个版本的jar包包含了运行Struts2应用所需的所有核心类库和依赖组件。以下是关于Struts...

    Struts2.1.6API

    struts2.1.6api. 想学习struts2的朋友们。希望能喜欢这个api,我也希望能给你们一点帮助。

    struts2.1.6 解决日历问题

    struts2.1.6 解决日历问题。区别struts2.0

    Struts2.1.6 Spring2.5.6 Hibernate3.3.2

    1. Struts2(struts2-core-2.1.6.jar):Struts2是一个强大的MVC框架,提供了全面的控制层解决方案。它基于拦截器的架构允许开发者通过插件扩展功能,同时提供了丰富的动作和结果类型。版本2.1.6提供了增强的异常...

    struts2.1.6 API (.chm)

    struts2.1.6 API chm文件格式的是本人自己创建的没有版权问题

    struts2.1.6 所有jar包和源码

    Struts2.1.6是Apache Struts框架的一个版本,这是一个流行且强大的Java Web应用程序开发框架,用于构建基于MVC(Model-View-Controller)模式的Web应用。它提供了简化HTTP请求处理、动作调度、视图渲染以及业务逻辑...

    struts2.1.6

    Struts2.1.6是Apache Struts框架的一个版本,这是一个流行且强大的Java Web应用程序开发框架,用于构建和维护可扩展、易于维护的MVC(Model-View-Controller)架构的应用程序。Struts2的核心设计理念是提供一种组织...

    struts-2.1.6_jar包(全)

    此外,Struts 2的注解功能和约定优于配置(Convention over Configuration)原则也是提高开发效率的重要特性。 总的来说,"struts-2.1.6_jar包(全)"提供了一个完整的Struts 2.1.6环境,帮助开发者快速启动Java Web...

    struts2.1.6-config-browser-plugin.api.chm

    struts2.1.6-config-browser-plugin.api.chm struts2.1.6-config-browser-plugin.api.chm

    struts-2.1.6-sources

    Struts 2.1.6 是一个非常重要的版本,在Java Web开发中占据着核心地位,尤其是在基于MVC(Model-View-Controller)架构的应用程序设计中。Struts 2 是Apache软件基金会的一个开源项目,它是Struts 1的升级版,提供了...

    struts2.1.6lib

    Struts2.1.6是Apache Struts框架的一个版本,它是基于MVC(Model-View-Controller)设计模式的Java Web应用程序开发框架。这个版本的lib目录包含了运行Struts2应用所需的所有核心类库,这些类库使得开发者能够构建...

    struts2.1.6零配置DEMO

    Struts2.1.6是Apache Struts框架的一个版本,它是一个基于MVC设计模式的Java Web应用程序框架。Struts2提供了丰富的功能,用于构建可维护、可扩展且易于开发的Web应用。在这个"struts2.1.6零配置DEMO"中,我们将深入...

    Struts2.1.6 jar包

    Struts2.1.6是Apache Struts框架的一个版本,它是基于MVC(Model-View-Controller)设计模式的Java Web应用程序开发框架。这个版本的Struts2包含了多个jar包,用于实现其核心功能和扩展服务。Struts2提供了一个强大...

    Struts2.1.6-all.zip (lib)

    Struts2.1.6-all.zip 是一个包含Struts2框架版本2.1.6所有库文件的压缩包,主要用于Java Web开发。Struts2是一个开源的MVC(Model-View-Controller)框架,它继承了经典的Struts1框架,并在功能、性能和灵活性上进行...

Global site tag (gtag.js) - Google Analytics