错误代码如下:
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:2139) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2083) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2029) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1999) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1952) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1156) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:765) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4989) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 42 more
网上给的答案都是调整Xss参数,其实不是正确的做法,
-Xss:每个线程的Stack大小,“-Xss 15120” 这使得tomcat每增加一个线程(thread)就会立即消耗15M内存,而最佳值应该是128K,默认值好像是512k.
具体报错如下
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.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVe
ctor]
因为tomcat启动会去扫描jar包,看错误信息org.bouncycastle.asn1.ASN1EncodableVector,是出在这个类
这个类似出现在bcprov*.jar这个包
所以在tomcat的conf目录里面catalina.properties的文件,
在tomcat.util.scan.DefaultJarScanner.jarsToSkip=里面加上bcprov*.jar过滤
启动不会报错了
或者升级tomcat版本(绝对解决)
参考自:https://blog.csdn.net/lb89012784/article/details/50820118