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

2

14

[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

Brazee answered 12/6, 2012 at 8:2 Comment(0)
D
18

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

Deicer answered 12/6, 2012 at 8:5 Comment(7)
can u plz tel how to add it to build pathBrazee
Which IDE you are using?, Is it maven project (pom) ?Deicer
select proejct > right click > properties > java build path > add external jars > browse to your servlet-api from your local file system > press OK > refresh the projectDeicer
But while running my local host.. I am getting 404 error now.. what i do for this nowBrazee
I am getting this waring now .. WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:QRCode' did not find a matching property. Jun 12, 2012 1:46:17 PM org.apache.coyote.AbstractProtocol initBrazee
@JigarJoshi I did that but the problem is not yet solved, I am using eclipse Juno and tomcat 7.. Inside <webapp> tab of web.xml I have version 2.4..Ludhiana
i m having jar in build path but getting the same exception. can anyone help me with thisEaves
K
11

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
Kirst answered 7/11, 2012 at 12:48 Comment(1)
+1 - trying to start hudson-3.0on tomcat 7 was causing this error message. I renamed the servlet jar in the hudson app to servlet.jar.hide and that fixed it. Thanks!Cheju

© 2022 - 2024 — McMap. All rights reserved.