INFO: validateJarFile(<APP_PATH>\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class.
We are using Apache Tomcat to deploy web applications, and getting the above message when Apache Tomcat is started. All web applications inside Tomcat are working fine, however no developer would want to see message (at least we do not want to see).
The above message is only a warning message due to the existence of multiples of the same javax.servler.Servlet.class for Tomcat runtime to pick; and this extra instance has come from a jar file named <APP_PATH>\WEB-INF\lib\servlet-api.jar. Tomcat has its own servlet-api.jar file; look at the following folders to locate the file (depending on the Tomcat version; location may be different).
- <TOMCAT_HOME>\common\lib
- <TOMCAT_HOME>\lib
- <TOMCAT_HOME>\webapps\<PROJECT>\WEB-INF\lib
Thanks this helped me.
ReplyDeleteHelped me as well, many thanks! :)
ReplyDeleteAfter removing the jar file from my web application,it shows the same error-servet-api.jar not loaded....nw what i do
ReplyDeleteTHANK YOU A LOT.... i removed that servelt-api.jar from my application and it worked!!!
ReplyDeleteHi,
ReplyDeleteI'd like to elaborate on that.
Not only do you not need to, but you even must not add any version of the servlet API to your webapp.
The servlet API and more important its implementation is provided by the servlet container, in your case Tomcat.
Due to the way classloaders in a servlet/jee environment work, adding the servlet API to your JEE app can cause severe problems. In JEE environments the classloader hierarchy works different, as it FIRST looks in the webapp/ear for a class to load before referring to parent classloaders.
Now imagine deploying your webapp on a servlet 2.4 compatible container having servlet api 2.5 in your classpath....
In fact, Tomcat does not check whether the servlet api in your webapp matches the servlet api version of Tomcat. It always delegates to the parent classloader informing you about this severe misconfiguration. The same is true for all packages of the java.* namespace.
And another big thank you from here. Also kudos to dukeslittleb.
ReplyDeleteThank you! It has helped me a lot!
ReplyDeleteHi i have only one servlet.jar under my tomcat/common/lib directory in addition to tht while compiling the servlets i passed the servlet.jar file as part of the classpath still i seee tht error
ReplyDeleteI resolved the problem with removing the libraries from web-inf/lib as stated above and included log4j into the projects build path and imported one sample log4j.properties file into the project. thank you!
ReplyDeletethanks,
ReplyDeleteit helped me
hi
ReplyDeleteas above u said i have done it but still my problem is stand
what to do now because again my war file not work and error comes again and again.
thanks in advance.
plz tell me on joanthonipandu@rediffmail.com
Thx you a lot !!
ReplyDeleteThanks a lot,
ReplyDeleteThis amazing Tip worked for me too
Nice Top Sir!!!!
ReplyDelete