背景
记录遇到⼀次奇怪的错误,在发布war包到Tomcat的时候,出现了org.bouncycastle.asn1.ASN1Boolean⾮法循环依赖的错误。
INFO: Deploying web application directory /data/w/www/xxx-app/webapps/ROOTApr 02, 2019 9:59:52 PM org.apache.catalina.core.ContainerBase addChildInternalSEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] 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:1120)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
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 at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2188)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2135) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2010) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1961) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1319) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
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:5322) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 10 more
现象
第⼀台机器很早之前部署的并且也部署成功,第⼆台机器通过scp命令将第⼀台机器的整个tomcat拷贝到第⼆台上并且启动运⾏,tomcat抛出这个异常。
解决⽅案
1. 进⼊tomcat WEB-INF下的LIB路径中。
2. 在该路径下执⾏ find . -name * -exec grep -l \"ASN1Boolean\" {} ;3. 发现查询出来的jar包有./fr-third-8.0.jar , ./bcprov-jdk-1.46.jar
4. 在该项⽬中帆软报表已经没有使⽤了,不知道为何还会引⼊这个fr-third-8.0.jar这个包5. 排除该包fr-third-8.0.jar,并且重新启动,启动完成。
⼩结
对于为什么会出现循环依赖的这个问题,为什么会不确定性出现,按理说依赖冲突应该所有的机器都会出现这个错误,会什么会不定性出现?还在进⼀步调研中...有结论会在此博客更新。
因篇幅问题不能全部显示,请点此查看更多更全内容