问题描述
本人用的Myeclipse 8.5 Tomcat6.0.35是不是jar包没导入对严重: Exception starting filter struts2Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/apache-tomcat-6.0.35-windows-x86/apache-tomcat-6.0.35/webapps/struts2_spring/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:209)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.ng.InitOperations.initDispatcher(InitOperations.java:69)at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)at org.apache.catalina.core.StandardService.start(StandardService.java:525)at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)at org.apache.catalina.startup.Catalina.start(Catalina.java:595)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:601)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/E:/apache-tomcat-6.0.35-windows-x86/apache-tomcat-6.0.35/webapps/struts2_spring/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:30:72 - bean - jar:file:/E:/apache-tomcat-6.0.35-windows-x86/apache-tomcat-6.0.35/webapps/struts2_spring/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:194)... 34 more 问题补充:你有引用 xwork-core-X.X.X.jar 吗?不是的,少点东西,我给加上了,谢谢啦
解决方案
你有引用 xwork-core-X.X.X.jar 吗?
解决方案二:
缺少包,及struts.xml 文件检查下
解决方案三:
应该是没有找到struts的配置文件,你把配置文件放在包的根目录下面