未能启动组件的问题 by: java.lang.IllegalArgumentException: Failed to register servlet with name 'dispatcher'.

困扰已久的bug,百度无结果,谷歌有3,4篇文章跟我的一样,也没得到答案。

后来经过分析,bug得到解决。

分析:

未能启动组件异常::Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[

查看原因:Caused by: java.lang.IllegalArgumentException: Failed to register servlet with name 'dispatcher'.Check if there is another servlet registered under the same name.
定位错误:at com.jt.sys.config.WebAppInitializer.onStartup(WebAppInitializer.java:16)


看项目目录发现居然有2个同样的配置类包,



项目目录下面还有一个包放的是上面同样的类。无语了,导项目出现奇葩bug,困扰了2天妈的。
怪不得说会有相同的servlet。

严重: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CGB-JT-SYS-V1.01]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1017)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:993)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:712)
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:2003)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Failed to register servlet with name 'dispatcher'.Check if there is another servlet registered under the same name.
	at org.springframework.util.Assert.notNull(Assert.java:134)
	at org.springframework.web.servlet.support.AbstractDispatcherServletInitializer.registerDispatcherServlet(AbstractDispatcherServletInitializer.java:98)
	at org.springframework.web.servlet.support.AbstractDispatcherServletInitializer.onStartup(AbstractDispatcherServletInitializer.java:71)
	at com.jt.sys.config.WebAppInitializer.onStartup(WebAppInitializer.java:16)
	at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5669)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 10 more

七月 06, 2018 10:16:21 下午 org.apache.catalina.startup.HostConfig deployDescriptor
严重: Error deploying configuration descriptor D:\ws1803\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\CGB-JT-SYS-V1.01.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/CGB-JT-SYS-V1.01]]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1021)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:993)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:712)
	at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:2003)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)







你可能感兴趣的:(spring,spring)