jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
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.1.0</version>
<scope>provided</scope>
</dependency>
You get this warning message when the servlet api jar file has already been loaded in the container and you try to load it once again from lib
directory.
The Servlet specs say you are not allowed to have servlet.jar in your webapps
lib
directory.
- Get rid of the warning message by simply removing
servlet.jar
from yourlib
directory. - If you don't find the jar in the
lib
directory scan for your build path and remove the jar.
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\project\WEB-INF\lib
If you are running a maven project, change the javax.servlet-api
dependency to scope provided
in you pom.xml since the container already provided the servlet jar in itself.
To fix it, set the scope to provided. This tells Maven use code servlet-api.jar for compiling and testing only, but NOT include it in the WAR file. The deployed container will “provide” the servlet-api.jar at runtime.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>