首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts2.0jar包导入Unable to load configuration. - bean有关问题原因及解决方案

2013-09-11 
struts2.0jar包导入Unable to load configuration. - bean问题原因及解决方案导入下面五个jar包后,commons

struts2.0jar包导入Unable to load configuration. - bean问题原因及解决方案

导入下面五个jar包后,

commons-logging-1.0.4.jar

?

freemarker-2.3.12.jar

?

log4j-1.2.14.jar

?

ognl-2.6.11.jar

?

struts2-core-2.1.2.jar

?

xwork-2.1.1.jar

显示如下错误

2011-5-1 21:59:06 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/D:/Program%20Files/Java/tools/apache-tomcat-6.0.16/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178
?? ?at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
?? ?at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
?? ?at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
?? ?at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:213)
?? ?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:3709)
?? ?at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
?? ?at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
?? ?at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
?? ?at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
?? ?at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
?? ?at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
?? ?at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
?? ?at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
?? ?at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
?? ?at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
?? ?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
?? ?at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?? ?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?? ?at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?? ?at org.apache.catalina.core.StandardService.start(StandardService.java:516)
?? ?at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?? ?at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
?? ?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:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/D:/Program%20Files/Java/tools/apache-tomcat-6.0.16/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178
?? ?at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:239)
?? ?at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:100)
?? ?at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:156)
?? ?at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
?? ?... 30 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
?? ?at java.lang.Class.getDeclaredConstructors0(Native Method)
?? ?at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
?? ?at java.lang.Class.getDeclaredConstructors(Class.java:1836)
?? ?at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:229)
?? ?... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
?? ?at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
?? ?at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
?? ?at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
?? ?... 37 more
2011-5-1 21:59:06 org.apache.catalina.core.StandardContext start
严重: Error filterStart

?

解决办法导入commons-fileupload-1.2.1.jar

原因

查看StrutsTest/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178得知:

<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="struts" scope="default"/>

又由于错误信息

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException

Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException

综上可知:缺少jar包commons-fileupload-1.2.1.jar

?

一般情况下struts工程报Unable to load configuration. - bean - jar:错误,都是缺少相应jar导致

1 楼 sxm2017 2012-04-08   写的挺好的
我的异常网推荐解决方案:com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register,http://www.myexception.cn/j2ee/307924.html

热点排行