转自:https://blog.csdn.net/u011422744/article/details/39851693
在SSH开发,搭建环境的时候,启动tomcat服务器,就报这个异常!
信息: No WebApplicationInitializer types detected on classpath
08:56:31,833 ERROR Dispatcher:38 - Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)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.initFilter(ApplicationFilterConfig.java:279)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4828)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5508)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)at java.util.concurrent.FutureTask.run(FutureTask.java:138)at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)at java.lang.Thread.run(Thread.java:619)Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)... 21 moreCaused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:30:124 - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)... 24 more 2014-10-7 8:56:31 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 Unable to load configuration. - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)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.initFilter(ApplicationFilterConfig.java:279)at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4828)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5508)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)at java.util.concurrent.FutureTask.run(FutureTask.java:138)at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)at java.lang.Thread.run(Thread.java:619) Caused by: Unable to load configuration. - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)... 19 more Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)... 21 more Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:30:124 - bean - jar:file:/D:/Tomcat%207/apache-tomcat-7.0.55/webapps/futureOA/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)... 24 more 2014-10-7 8:56:31 org.apache.catalina.core.StandardContext startInternal 严重: Error filterStart 2014-10-7 8:56:31 org.apache.catalina.core.StandardContext startInternal 严重: Context [/futureOA] startup failed due to previous errors2014-10-7 8:56:31 org.apache.catalina.startup.HostConfig deployDirectory
解决方法:
看 cause by:
就会发现自己导入的jar包:struts2-core-2.3.16.3.jar 和 struts2-core-2.2.1.jar 两个jar包冲突了。
所以,删除一个 即可解决!