我的tomcat版本是8.0.50,官网中对jdk的要求如下图

我使用jdk1.7.0_79编译项目,在本地使用tomcat8.0.50运行项目可以正常启动,但是在linux中启动就报如下的错误;

使用dk1.8.0_172编译升级后的项目(相应的依赖jar包需要在jdk变成1.8之后做相应的升级),在linux上运行启动就正常了。

tomcat在linux中启动时报如下错误

27-Sep-2018 16:44:28.731 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal 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:162)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1126)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	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 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:2107)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2053)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1998)
	at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1968)
	at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1922)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1165)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:782)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5221)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	... 10 more

27-Sep-2018 16:44:28.734 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory /data/tomcat8jinfu/webapps/ROOT
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1126)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

下面是从网上找到的原因分析和解答: 

因为tomcat启动会去扫描jar包,看错误信息org.bouncycastle.asn1.ASN1EncodableVector,是出在这个类

这个类似出现在bcprov*.jar这个包

所以在tomcat的conf目录里面catalina.properties的文件,

在tomcat.util.scan.DefaultJarScanner.jarsToSkip=里面加上bcprov*.jar过滤

启动不会报错了

或者升级tomcat版本

Logo

更多推荐