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

匿名 (未验证) 提交于 2019-12-03 08:35:02

问题:

This question already has an answer here:

[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

回答1:

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



回答2:

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!