jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Last updated
App Shah

Crunchify » Java and J2EE Tutorials » jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

maven complexity

Are you getting below exception?

INFO: validateJarFile(c:\tomcat\Tomcat1\webapps\myApplication\WEB-INF\lib\servlet-api.jar) – jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

Even though this is INFO message I wanted to get rid off it.

The servlet api jar file must not be embedded inside the webapp since, obviously, the container already has these classes in its classpath: it implements the interfaces contained in this jar.

The dependency should be in the provided scope, rather than the default compile scope, in your Maven pom:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>

This resolved my issue.

4 thoughts on “jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class”

    • Open the project’s properties
      Select Java Build Path
      Select Libraries tab
      From there you can Add External Jars

      Reply

Leave a Comment