我已经Spring MVC project template使用STS 3.7.3和创建了一个模板jdk 1.8。
Spring MVC project template
STS 3.7.3
jdk 1.8
我在Pivotal tc Server Developer Edition提供的上运行生成的代码STS 3.7.3。服务器已启动,应用程序已部署,并显示Hello world页面。
Pivotal tc Server Developer Edition
Hello world
但是,当我添加tomcat 8.0服务器(在没有任何已部署应用程序的情况下成功启动)并开始部署完全相同的应用程序时,我得到:
tomcat 8.0
SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/core]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:915) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) 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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/core]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) ... 6 more Caused by: java.lang.NullPointerException at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scanWebInfClasses(TldScanner.java:401) at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:208) at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:106) at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:103) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5261) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more maj 25, 2016 2:36:25 PM org.apache.catalina.core.ContainerBase startInternal SEVERE: 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(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:915) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) 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: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:923) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more maj 25, 2016 2:36:25 PM org.apache.catalina.startup.Catalina start SEVERE: 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:153) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:787) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:923) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 11 more maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-nio-8080"] maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["ajp-nio-8009"] maj 25, 2016 2:36:25 PM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Catalina maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["http-nio-8080"] maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol destroy SEVERE: Failed to destroy end point associated with ProtocolHandler ["http-nio-8080"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:316) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:492) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:821) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:534) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:877) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["ajp-nio-8009"] maj 25, 2016 2:36:25 PM org.apache.coyote.AbstractProtocol destroy SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:316) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:492) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:821) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:534) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:877) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:297) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
从我看来,问题可能与版本问题有关servlet- api.jar,pom.xml但是我认为添加scope:provided应该可以解决问题(事实并非如此)。
servlet- api.jar
pom.xml
scope:provided
谁能给我一个提示我做错了什么?
此堆栈跟踪的相关部分是:
Caused by: java.lang.NullPointerException at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scanWebInfClasses(TldScanner.java:401) at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:208) at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:106) at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:103) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5261) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) ... 6 more
Tomcat 8.0.35(2016年5月16日发布)中引入了一个错误 - TldScannerCallback.scanWebInfClasses方法已更改为依赖于该getResourcePaths方法。它已在Tomcat 8.0.36(2016年6月9日发布)中修复。
TldScannerCallback.scanWebInfClasses
getResourcePaths
如果它可以帮助其他人找到答案,我只是在从Tomcat 8.0.32进行次要版本升级到8.0.35(Amazon EC2实例今天早上推送了8.0.35更新)之后才遇到此问题。以我为例,自从Tomcat 5被此更新破坏以来,一个无需修改即可运行的Web应用程序。
使用上述错误报告中的建议,我能够解决该问题。具体来说,一个空WEB-INF/classes/META- INF文件夹正在触发此错误,因此我在该文件夹中创建了MANIFEST.MF文件。
WEB-INF/classes/META- INF
这里是提交所引入的错误,而这里犯的是固定的bug,在提交者是指它作为一个“ 罕见的NPE的情况下 ”,知道是什么意思(意味着文件夹很少空?)。在阅读了提交中的注释之后,很明显,这是一种抑制工作代码中的FindBugs报告的黑客,进而产生了破坏Web应用程序的实际错误。