`
j2ee_yohn
  • 浏览: 172175 次
  • 性别: Icon_minigender_1
  • 来自: 湖南/株洲
社区版块
存档分类
最新评论

请您先登录,才能继续操作

Unable to load bean: type: struts-derfault.xml异常

阅读更多

很多朋友在使用Struts2时都会遇到这个异常,导致其主要原因还是因为加错了包,大家只要将xwork-2.1.1.jar和struts2-core-2.1.2.jar,换成xwork-2.0.4.jar和struts2-core-2.0.14.jar或者struts2-core-2.0.14.jar

 这个包就可以了,为什么会有这个原因,本人还没去研究,也还没有去查询。如果大家有见解请指导指导。

 

严重: Exception starting filter struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:29:72
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
 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:1022)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
 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:700)
 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:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 - bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:29:72
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
 ... 33 more

分享到:
评论
2 楼 imcaptor 2012-07-17  
如果tomcat/lib和WEB-INF/lib下面同时有struts的jar包,也会报这个错误。
1 楼 only_java 2009-03-19  
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:29:72


at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 - bean - jar:file:/D:/tomcat-5.5.27/webapps/strutsDemo/WEB-INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:29:72

仔细看下struts2-core-2.1.2.jar及struts2-core-2.0.14.jar,为什么?我也碰到你这样的错误!我用的包是xwork-2.0.1.jar及struts2-core-2.0.6.jar,我的错误跟你一致。

相关推荐

Global site tag (gtag.js) - Google Analytics