我使用STS3.7.3
和JDK1.8
创建了一个模板Spring MVC project template
。
我在STS 3.7.3
上提供的Pivotal tc Server Developer Edition
上运行生成的代码。服务器已启动,应用程序已部署,并显示Hello World
页面。
但是,当我添加Tomcat8.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
应该可以解决这个问题(它没有)。
谁能给我一个提示,我做错了什么?
这个堆栈跟踪的相关部分是:
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日发布)中引入了一个bug-TLDScannerCallback.ScanWebInfClasss
方法被更改为依赖于GetResourcePaths
方法。它在Tomcat 8.0.36(2016年6月9日发布)中被修复。
如果它能帮助其他人找到这个答案,我只是在做了一次从Tomcat 8.0.32到8.0.35的小版本升级后才遇到这个问题(Amazon EC2实例今天早上推送了8.0.35更新)。在我的例子中,一个自Tomcat5以来一直未做任何修改的web应用程序被这个更新破坏了。
这里是引入bug的commit,这里是修复bug的commit,其中committer将其称为“罕见的NPE情况”,不管这意味着什么(暗示文件夹很少是空的?)。在阅读了提交中的注释之后,很明显,这是一次在工作代码中抑制FindBugs报告的攻击,这反过来又产生了一个破坏web应用程序的真正的bug。
问题内容: 我在网上搜索了很多如何从TWIG模板访问全局数组的方法,并发现了以下内容:,但是当我调用它时,它返回一个空字符串。我有一个和打电话时,我收到此错误:。我做错了什么? 问题答案: 引用对象而不是数组。我不认为该数组是可访问的,除非您将其显式传递给每个Twig模板,或者进行扩展使其可用。 Symfony2是面向对象的,因此您应该使用该对象设置会话属性,而不要依赖数组。该对象会将这些东西从您
我遇到了一个问题,让我的spring boot应用程序加载我的简单网页。我已经复制了这里提供的示例,并在模板目录中实现了它们,我一直得到这个错误 TemplateInputException:解析模板[index]时出错,模板可能不存在,或者任何已配置的模板解析程序都无法访问模板 下面是文件目录 如有任何帮助,不胜感激,谢谢。
门户首页 模板文件对应的是模板目录/portal/index.html,这个页面没有被控制器 assign任何变量,模板开发者完全可以用 portal:articles等其它模板标签制作此页面 文章列表 默认模板文件(可以增加更多) 默认模板文件对应的是模板目录/portal/list.html 控制器 assign 过的变量 $category这个变量是就是一个文章分类对象,可以当成数组直接用
我在NestedScrollview中有一个回收器视图...除了一个thig,一切都正常。我在NestedScrollview中总共有三个视图,前两个是LinearLayout,然后是回收器视图。当我运行我的应用程序时,活动不会显示前两个布局,它从回收器视图的顶部开始。 如何显示我的布局: 它应该如何显示: 我正在加载此enite布局下的一个视图寻呼机和我的视图寻呼机是一个协调器布局的孩子。 我的
我正在尝试使用从多个位置加载模板。这个项目是使用开发的。 我有两个maven项目: > 我的网站:maven的主要项目,包含自定义模板,例如WEB-INF/ftl/landing/login。ftl 通用模板:包含位于WEB-INF/ftl的通用freemarker模板,例如WEB-INF/ftl/landing/login。ftl 例如,Freemarker的想法是在“我的网站”中搜索登陆/登录
问题内容: 如果我在Django中设置会话变量,例如: 有什么方法可以从模板中访问它,还是必须从视图中检索它,然后将其传递给模板? 询问是因为我想在模板中访问大约10个小会话变量,然后将所有10个从视图传递到模板可能会有些混乱。 (我必须使用会话变量,因为它是HttpResponseRedirect,但是出于我的目的,将变量存储在数据库中是过大的。) 那么-有什么方法可以直接在模板中获取会话变量?