How to fix StackOverflowError in org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry in Tomcat 7.0.35

We are launching an old version of Tomcat, and a new web application triggered a stack trace similar to 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)

This was mentioned in https://bz.apache.org/bugzilla/show_bug.cgi?id=53871 , and later versions (like Tomcat 8) do not seem to be affected.

How can i fix this?

+4
source share
2 answers

Since updating Tomcat was not possible, I needed a way around this problem.

As it turned out, Tomcat 7.0.47 has the same problem, but reports better. When running locally, the report showed me the following:

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 :

org.apache.catalina.startup.ContextConfig.jarsToSkip=bcprov*.jar

, Tomcat.

+12

, . :

, bcprov-jdk . :

bcprov-jdk15on
bcprov-jdk16

Maven,

mvn dependency:tree -Dverbose -Dincludes=org.bouncycastle

, . jdk16, - jdk15on, .

+4

All Articles