Tomcat output Servlet-api.jar-jar not loaded workaround

Source: Internet
Author: User
Tags apache tomcat

Tomcat output Servlet-api.jar-jar not loaded workaround

Console output information After Tomcat is started: Web-inf/lib/servlet-api.jar not loaded workaround
Info:starting Servlet Engine:apache tomcat/7.0.54
Dec 1:08:07 PM Org.apache.catalina.loader.WebappClassLoader validatejarfile
Info:validatejarfile (/home/www/xxx/web-inf/lib/servlet-api-2.3.jar)-jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending Class:javax/servlet/servlet.class

The Servlet-api.jar package is placed in the tomcat/common/lib/, and the Servlet-api-2.3.jar of the project under Web-inf/lib is deleted to ensure tomcat/common/lib/and web-inf/ The jar in both directories of Lib is not duplicated and the problem is resolved.
Tested if deleting the Servlet-api.jar packet in tomcat/common/lib/does not start properly.
When Tomcat starts, it reads all the jar packages in the Tomcat/common/lib directory into memory, and if the same package is found in the Web-inf/lib directory in the application in the WebApps directory, it cannot be loaded, and it is estimated that a similar problem can occur between different versions of the package.

This jar package can be excluded from MAVEN when compiling the package:
<!--Servlets--
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
POM configuration to remove the upper part

Another: not MAVEN package compilation can be opened in the war package with an extract file, directly delete the jar package

Tomcat output Servlet-api.jar-jar not loaded workaround

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.