Eclipse 启动Tomcat失败

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ducp123/article/details/84070076

背景:项目从windows移植到Mac下,Windows运行正常,Mac就是死活不正常,尝试过N中方法,已崩溃。

说明:tomcat没问题,jar包都不缺,环境也没问题。

错误日志如下:


严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/xxx]]
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:945)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/xxx]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	... 6 more
Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
	at java.lang.Class.getDeclaredFields(Class.java:1916)
	at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
	at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:137)
	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:69)
	at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:336)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:776)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 6 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1352)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
	... 20 more

十一月 14, 2018 5:08:51 下午 org.apache.catalina.core.ContainerBase startInternal
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:945)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:641)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1400)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 6 more

十一月 14, 2018 5:08:51 下午 org.apache.catalina.startup.Catalina start
严重: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:641)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:789)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:953)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 11 more

十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-nio-8080"]
十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-nio-8009"]
十一月 14, 2018 5:08:51 下午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service Catalina
十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["http-nio-8080"]
十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol destroy
严重: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"]
java.lang.NullPointerException
	at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315)
	at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491)
	at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896)
	at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551)
	at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)

十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol destroy
信息: Destroying ProtocolHandler ["ajp-nio-8009"]
十一月 14, 2018 5:08:51 下午 org.apache.coyote.AbstractProtocol destroy
严重: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"]
java.lang.NullPointerException
	at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315)
	at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491)
	at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896)
	at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551)
	at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)

从第一行错误日志到最后一行,查看过N多篇博客,没啥用。

本项目错误为:缺失Spring-web-xxx.jar;项目运行的jar包没添加到Deployment Assembly里面。

具体添加步骤为:(真是想不到会出现这种问题)

1. 右键单击工程项目 ->点击 properties
2. 选择 Deployment Assembly
3. 点击 Add -> Java Build Path Entries -> Next

4. 选择 Maven Dependencies -> Finish -> Apply -> OK
5.重启服务。
 

添加步骤也可查看如下博客,带图,此处懒得截图了:

https://blog.csdn.net/chibimarukochan/article/details/78627204

猜你喜欢

转载自blog.csdn.net/ducp123/article/details/84070076