Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError

I am developing a Spring MVC application using STS (eclipse plugin) and maven.

For creating the project, I followed the STS wizard for a new "Spring MVC project". Afterwards, I added some dependencies to other projects and libraries.

However, when I am now trying to deploy the project to the integrated vFabric server of STS, I sometimes get an exception:

SEVERE: ContainerBase.addChild: start:  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/wsa]]     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)     ... Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/app] 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.ASN1EncodableVector]     at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2179)     ... 

When issuing a "maven clean", followed by a "maven install" and a restart of the server, the exception sometimes doesn't get thrown and the application works fine. Yet, most of the times, it doesn't work.

I guess there is no need to scan the bouncycastle dependencies for annotations.
Can I somehow disable this scanning for some jars?

I already tried adding metadata-complete="true" to my web.xml and increasing the stack size with no result.

What can I do to fix this?

like image 709
Matthias Avatar asked Jul 11 '13 03:07

Matthias


2 Answers

In my case the org.bouncycastle.asn1.DEREncodableVector class, which was causing the cyclic dependency, was served by two jars in the class path.

bcprov-jdk15on-1.47.jar and bcprov-jdk16-1.45.jar

Excluded the unwanted jar(bcprov-jdk16-1.45.jar) and it worked well

like image 177
amindri Avatar answered Sep 20 '22 19:09

amindri


You have a cyclic dependency. org.bouncycastle.asn1.ASN1EncodableVector depends on org.bouncycastle.asn1.DEREncodableVector which depends back on org.bouncycastle.asn1.ASN1EncodableVector which ... . This is an infinite cycle and so you're getting a StackOverflowException.

If you have the Maven plugin installed in Eclipse, look at the Dependency Hierarchy and look for these classes. I found someone with a similar issue here, he solved it by looking at the dependency tree and then adding an exclusion to break the cyclic dependency.

like image 25
g00glen00b Avatar answered Sep 17 '22 19:09

g00glen00b