问题描述
我们正在运行旧版本的 Tomcat,一个新的 Web 应用程序导致了这样的堆栈跟踪
We are running an old version of Tomcat, and a new web application has caused a stack trace like this
Caused by: java.lang.StackOverflowError
at org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.java:2269)
at org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.java:2269)
at org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.java:2269)
这已在 https://bz.apache.org/bugzilla 中提到/show_bug.cgi?id=53871 和更高版本(如 Tomcat 8)似乎不受影响.
This has been mentioned at https://bz.apache.org/bugzilla/show_bug.cgi?id=53871, and later versions (like Tomcat 8) don't seem to be affected.
我该如何解决这个问题?
How can I fix this?
推荐答案
由于升级 Tomcat 不是一种选择,我需要一种方法来解决这个问题.
Since upgrading Tomcat was not an option, I needed a way to work around this issue.
事实证明 Tomcat 7.0.47 有同样的问题,但报告更好.在本地运行时,报告向我展示了这一点:
As it turns out Tomcat 7.0.47 has the same issue, but better reporting. When run locally the reporting showed me this:
Caused by: java.lang.IllegalStateException: Unable to complete the scan for
annotations for web application [/api] 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]
找到有问题的 jar 文件后,我将其添加到 catalina.properties
文件中,如下所示:
Once I found the offending jar file, I added it to the catalina.properties
file like this:
org.apache.catalina.startup.ContextConfig.jarsToSkip=bcprov*.jar
这似乎解决了旧版 Tomcat 中的问题.
This appears to have worked around the issue in the older version of Tomcat.
这篇关于如何修复 Tomcat 7.0.35 中 org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry 中的 StackOverflowError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!