Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies

匿名 (未验证) 提交于 2019-12-03 02:51:02

问题:

My app is quit big and using many jars and tools. Platform - windows 2008 server, Spring , hibernate, Quarts, mysql, tomcat-7.35

When I deploy and start the server first time working perfectly, but If I restart I am getting the below err

    SEVERE: ContainerBase.addChild: start:      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestProject]]     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)     at java.util.concurrent.FutureTask.run(FutureTask.java:166)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)     at java.lang.Thread.run(Thread.java:722)     Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/TestProject]. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies     at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2109)     at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1981)     at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1947)     at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1932)     at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1326)     at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)     at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     ... 11 more     Caused by: java.lang.StackOverflowError     at java.util.HashSet.<init>(HashSet.java:103)     at org.apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.java:2252)     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)     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)     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)     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)     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)     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)      Feb 16, 2013 12:16:10 PM org.apache.catalina.startup.HostConfig deployDirectory     SEVERE: Error deploying web application directory C:\apache-tomcat-7.0.35\webapps\TestProject     java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[TestProject]]     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)     at java.util.concurrent.FutureTask.run(FutureTask.java:166)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)         at java.lang.Thread.run(Thread.java:722) 

回答1:

The stack trace says that tomcat is running out of stack space on the thread that is scanning your application looking for java based servlet configurations. There are three ways you can solve this problem.

Update 1

you need to pass -Xss4m to your jvm to set the stack size, -Xss10m would set it to 10mb.

I am using Hibernate and Spring in my application too with annotations, the scanning that tomcat does is to look for Servlet 3.0 annotations so you can still restrict things while using hibernate and spring annotations, since hibernate and spring annoations are scanned for by spring and hibernate.

If you are running tomcat as a windows service you will need, to pass the arguments via procrun since that is the executable that is launching the jvm. The docs for procrun are at http://commons.apache.org/daemon/procrun.html. tomcat7.exe is really procrun.exe renamed, which means that all your jvm options are written to the registery under

The basic Service definitions are maintained under the registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

Additional parameters are stored in the registry at:

HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\ProcRun 2.0\\Parameters

On 64-bit Windows procrun always uses 32-bit registry view for storing the configuration. This means that parameters will be stored inside:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\ProcRun 2.0\

Update 2

Tomcat has been tweaking how the scanner works between point releases. try rolling forward through the versions 7.25,7.26 ... etc to find the version at which it breaks, the go through the release notes for that version to see if they changed how the scanner works.

Another thing you can try doing, is to create another war file which has all the third party jars in your WEB-INF\lib but not your code. See if you get that error if you start up, and if you do then should file a bug report with tomcat and make available to them your sample project that replicates the problem, on github or some other free code hosting system. I am sure if there is a bug they will fix it.



回答2:

To fix this for TC Server 2.9, running Tomcat 7.0.39 I restricted the jars to skip during startup for the context config using:

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

in catalina.properties.



回答3:

In My case iTextpdf JAR(5.06 version) causing problem as it had dependancy on org.bouncyCastle.*.jar and it was creating cyclic dependancy.

After updating it to 5.5.6 version, worked perfectly. If you are adding maven dependancy , clean and update maven project.

<dependency>             <groupId>com.itextpdf</groupId>             <artifactId>itextpdf</artifactId>             <version>5.5.6</version> </dependency> 


回答4:

I'm not running Tomcat as a Windows service, so to pass -Xss10m through, I edited catalina.bat, towards the bottom:

:doJpda if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -Xss10m -classpath "%CLASSPATH%" -  Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% goto end 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!