Tomcat boot error too low setting FOR-XSS StackOverflow
Source: Internet
Author: User
Students who use the Tomcat 7.0.3x version can find that Tomcat startup is slow, and may also encounter the following boot-time exceptions:
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.
The tomcat7.0.3x version supports servlet3.0 features, such as supporting @webservlet, @WebListener, and to support these features, Tomcat has to scan every class in all jar packs. This anomaly indicates that when the jar packet was scanned, the recursive call was too deep, causing the stack to overflow, and Tomcat gave a bad idea for you to increase XSS, which is still not good, XSS increased, the number of available threads is less.
Analysis of the Tomcat source code, found that it scanned the following process:
1. Scan all jar Packs
2. Initialize Servletcontainerinitializer implementation by looking for definitions within the Meta-inf/services/javax.servlet.servletcontainerinitializer file in the jar package
3. If metadata-complete= "True" is configured in Web.xml or no servletcontainerinitializer implementation is found, the jar package will not continue to be scanned
If the startup problem shown above appears, you need to modify the {Tomcat path}/conf/web.xml modification method: <web-app version= "3.0 xmlns=" http://java.sun.com/xml/ns/ Java ee "xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://java.sun.com/xml/ns/ Java ee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd "metadata-complete=" True >
Most of the answers on the Internet are that the addition of metadata-complete= "true" in Web.xml can avoid this anomaly. Indeed, in many scenarios, this anomaly can be avoided. But the one with the spring-web-3.1.0.release is a mug, which defines a servletcontainerinitializer in the jar package, or it causes a scan jar package.
We can solve this problem in a different way, and we let tomcat not scan the specified jar pack, and Tomcat will be much easier, Defaultjarstoskip is defined in Org.apache.tomcat.util.scan.StandardJarScanner, and with this we can skip some jar packs.
If you don't want to use servlet3.0 annotation support, Add a ", *" after the Tomcat.util.scan.DefaultJarScanner.jarsToSkip value in Tomcat's catalina.properties configuration file, so that all jar packs are not scanned. Faster startup and no exceptions.
Tomcat has a small bug in the process of scanning, like I met
Severe:unable to process Jar entry [__macosx/cn/****/._handlerfactory.class] from ...
This is tomcat, after scanning the file with the. class suffix, parsing the class, which is obviously not a Java class file. Tomcat should not only judge the suffix to. class is the Java class file.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.