关于sturts2配置时tomcat的异常报错

配置完struts2框架(配置文件都已经写完),发布到tomcat上启动这只猫的时候出现了如下异常

严重: Dispatcherinitialization failed

Unable to load configuration. -bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)

    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)

    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)

    atorg.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: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(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)

    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

Caused by: Unable to load bean:type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)

    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)

    atcom.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)

    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)

    ... 31 more

Caused by: Bean type classcom.opensymphony.xwork2.ObjectFactory with the name xwork has already beenloaded by bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.2.3.1.jar!/struts-default.xml:29:72- bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)

    ... 34 more

2014-10-17 12:30:38org.apache.catalina.core.StandardContext filterStart

严重: Exceptionstarting filter struts2

Unable to load configuration. -bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)

    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)

    atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)

    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(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)

    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

Caused by: Unable to loadconfiguration. - bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)

    atorg.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)

    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)

    ... 29 more

Caused by: Unable to load bean:type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)

    atorg.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)

    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)

    atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)

    ... 31 more

Caused by: Bean type classcom.opensymphony.xwork2.ObjectFactory with the name xwork has already beenloaded by bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.2.3.1.jar!/struts-default.xml:29:72- bean - jar:file:/E:/CUDA/*******(文件路径,请无视)/Java/mySQL+Tomcat+Myeclipse/apache-tomcat-5.5.27/webapps/StrutsTest/WEB-INF/lib/struts2-core-2.3.1.jar!/struts-default.xml:29:72

    atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)

    ... 34 more

2014-10-17 12:30:38org.apache.catalina.core.StandardContext start

严重: ErrorfilterStart

2014-10-17 12:30:38org.apache.catalina.core.StandardContext start

严重: Context[/StrutsTest] startup failed due to previous errors

2014-10-1712:30:38 org.apache.coyote.http11.Http11BaseProtocol start


看上去很吓人,实际上是因为tomcat中对应工程下的lib中的jar包出现重复,其实当你在工程中的lib导入jar包后,tomcat容器中对应工程也会有jar包的副本,但是当你删除掉原工程内的jar包后却仍然会在tomcat中保留jar,因此会出现struts的jar包冲突(即Caused by: Bean type classcom.opensymphony.xwork2.ObjectFactory with the name xwork has already beenloaded by bean - jar),所以才会出现上述错误,故只要删除掉tomcat项目中的jar包再重新发布即可。

你可能感兴趣的:(关于sturts2配置时tomcat的异常报错)