tomcat启动报错:Unable to complete the scan for annotations for web application [] due to a StackOverflow

Posted 快乐崇拜234

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat启动报错:Unable to complete the scan for annotations for web application [] due to a StackOverflow相关的知识,希望对你有一定的参考价值。

欢迎关注本人公众号


关键报错信息:

Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [] due to a StackOverflowError. Possible 
root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was 
[org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]

具体报错信息如下:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Jun 04, 2018 3:17:54 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/ewallet/star-jupiter/star-jupiter-pre/default/webroot/WEB-INF/lib/tomcat-embed-el-8.5.14.jar) - jar not loaded. See Servlet 
Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Jun 04, 2018 3:17:55 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].StandardContext[]]
	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:1123)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	... 6 more
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [] due to a StackOverflowError. Possible 
root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was 
[org.bouncycastle.asn1.ASN1Boolean->org.bouncycastle.asn1.DERBoolean->org.bouncycastle.asn1.ASN1Boolean]
	at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2109)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2056)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1931)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1897)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1882)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1314)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 6 more

Jun 04, 2018 3:17:55 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(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
	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:321)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 6 more

Jun 04, 2018 3:17:55 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[8281]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
	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:321)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 11 more


在网上搜索了一下,很多说是修改catalina.properties的配置文件,但就算是解决了问题,也不是最好的办法。
这个问题的根本原因是jar包冲突,继承关系刚好相反,故造成tomcat启动的循环依赖问题,导致堆栈溢出。所以应该考虑的是如何解决jar依赖问题。

org.bouncycastle.asn1.ASN1Boolean这个类入手。查看系统中·ASN1Boolean`出现在了两个包中:

<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>

<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>

所以根据实际情况,去除一个即可。

以上是关于tomcat启动报错:Unable to complete the scan for annotations for web application [] due to a StackOverflow的主要内容,如果未能解决你的问题,请参考以下文章

tomcat启动报错:Unable to complete the scan for annotations for web application [] due to a StackOverflow

tomcat启动后报错Bad version number in .class file (unable to load class oracle.jdbc.OracleDriver)

nacos的部署以及nacos启动报错“Unable to start embedded Tomcat”(部分解决)

tomcat报错-----》Unable to open debugger port IDEA Unable to open debugger port

报错:Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requi

springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFac