Tomcat启动报错:Possible root causes include a too low setting for -Xss and illegal cyclic inheritance de...

本文介绍了解决Tomcat启动时出现的注解扫描异常问题,提供了通过配置排除特定jar包或升级Tomcat版本的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误代码如下:

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.youkuaiyun.com/lb89012784/article/details/50820118

转载于:https://www.cnblogs.com/miaoying/p/9475916.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值