Tomcat 启动异常深度剖析
2015-08-24 10:53
543 查看
最近在使用tomcat 部署应用是遇到异常如下:
分析原因:tomcat 启动扫描注解时抛出异常 StackOverflowError,扫描具体类为:
从以下方面检查错误:
1. 栈内存不足,修改tomcat启动参数,增加栈内存, 如:-Xss100m
2. 在你的应用中告诉tomcat不要扫描annotations, 修改web.xml 如下:
3. 限制tomcat扫描jar 文件,参考:http://tomcat.apache.org/tomcat-7.0-doc/config/jar-scanner.html
4. 另外, 你可以创建一个war包,其中在WEB-INF\lib中包含第三方依赖的jar, 当启动tomcat时,如果发现错误信息类似如下:
[html] view
plaincopy
Unable to complete the scan for annotations for web application [/xxxx] 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]
这个可能是第三方api的一个bug.可以到其官网下载最新版本看看是否修复。
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/xxxx] 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: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
分析原因:tomcat 启动扫描注解时抛出异常 StackOverflowError,扫描具体类为:
org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector
从以下方面检查错误:
1. 栈内存不足,修改tomcat启动参数,增加栈内存, 如:-Xss100m
2. 在你的应用中告诉tomcat不要扫描annotations, 修改web.xml 如下:
[html] view plaincopy<web-app id="WebApp_ID" version="2.4" metadata-complete="true" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
3. 限制tomcat扫描jar 文件,参考:http://tomcat.apache.org/tomcat-7.0-doc/config/jar-scanner.html
4. 另外, 你可以创建一个war包,其中在WEB-INF\lib中包含第三方依赖的jar, 当启动tomcat时,如果发现错误信息类似如下:
[html] view
plaincopy
Unable to complete the scan for annotations for web application [/xxxx] 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]
这个可能是第三方api的一个bug.可以到其官网下载最新版本看看是否修复。
相关文章推荐
- Eclipse启动Tomcat错误:Several ports (8080, 8009) required by Tomcat v6.0 Server at localhost are already
- Linux下Tomcat的安装配置
- Linux下Tomcat的启动、关闭、杀死进程
- 在陌生Linux环境查看Tomcat服务的方法
- 一个Myeclipse同时配置多个Tomcat
- 如何在Eclipse配置Tomcat服务器
- tomcat安装目录下各文件夹
- Tomcat的Server.xml虚拟主机和虚拟目录的配置
- Tomcat与Web应用的配置
- tomcat_server.xml配置说明
- Tomcat的配置文件 —— server.xml
- IntelliJ IDEA启动Tomcat后,却无法访问Tomcat首页?
- IntelliJ IDEA 12 与 Tomcat7 配置
- tomcat8配置(win8)
- jenkins------结合maven将svn项目自动部署到tomcat下
- 《how tomcat work》 搬运工 Chapter 6:Lifecycle & Chapter 7:Logger &Chapter 8: Loader
- day08
- 采用maven 对tomcat 进行自动部署
- Tomcat 6.0_39安装
- Tomcat体系结构