一、Tomcat报too low setting for -Xss and illegal cyclic inheritance dependencies 内存溢出
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/mypro]. 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)
可能原因:
tomcat7.0.3X版本支持servlet3.0的特性,比如说支持@WebServlet、@WebListener,要支持这些特性,tomcat就得去扫描所有的jar包里面的每个类。这个异常表明在扫描jar包的时候,递归调用太深,导致栈溢出了,tomcat给了一个馊主意,让你增大xss,这个还是不好,xss加大了,可用线程数就少了。
解决方法:
在apache-tomcat-7.0.79.conf.catalina.properties文件最后加上
tomcat.util.scan.StandardJarScanFilter.jarsToSkip = bcpkix-*.jar,bcprov-*.jar,fr-*.jar
如果你不想使用servlet3.0 annotation支持,在tomcat的catalina.properties配置文件中tomcat.util.scan.DefaultJarScanner.jarsToSkip的值后面加一个”,*”,这样就不会扫描所有的jar包了。启动更快,也不会出异常。