Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

validateJarFile(servlet-api.jar) - jar not loaded in tomcat using eclipse [duplicate]

[Tomcat] validateJarFile(servlet-api.jar) - jar not loaded. Offending class: javax/servlet/Servlet.class org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class.

I googled for this,I got to know that I am using servlet-api.jar in my project WEB-INF/lib, and also I am having same servlet-api.jar in tomcat/lib folder. so I have to remove servlet-api.jar, But if I remove that jar, I am getting error in import javax.servlet.*; so how to I solve this, help me for fix this error.Thanks in advance

like image 345
user1443848 Avatar asked Jun 12 '12 08:06

user1443848


2 Answers

The error you are getting is because servlet-api needs to be on compile time build path, at runtime your app will have the servlet-api available from tomcat/lib

So add it to your build path simply, In short servlet-api is required at compile aswell as runtime

like image 144
jmj Avatar answered Nov 13 '22 12:11

jmj


Try this to remove the warning message you were getting.

  • The Servlet specs say you are not allowed to have servlet.jar in your webapps lib directory.
  • If you want to get rid of the warning simply remove servlet.jar from

C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\YOUR_project\WEB-INF\lib
like image 22
Lucky Avatar answered Nov 13 '22 12:11

Lucky