Java News Tips Software
Java News Tips Software | Contact | Facebook | Twitter RSS

[Tomcat] validateJarFile(servlet-api.jar) - jar not loaded. Offending class: javax/servlet/Servlet.class

org.apache.catalina.loader.WebappClassLoader validateJarFile
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
.

validateJarFile jar not loadedWe 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
Your web applications have the same servlet-api.jar file inside following folder.

<TOMCAT_HOME>\webapps\<PROJECT>\WEB-INF\lib

As the Tomcat runtime has the required javax/servlet/Servlet.class file loaded from its own lib\servlet-api.jar file, you do not need to place it inside each and every web application. After removing the jar file from your web application, you will not receive the message again.

Related Article

Labels: , , ,


15 Comments

  1. Anonymous Anonymous on July 23, 2009 10:26 AM  
    Thanks this helped me.
  2. Anonymous Anonymous on April 13, 2010 11:25 PM  
    Helped me as well, many thanks! :)
  3. Anonymous Anonymous on May 18, 2010 11:19 AM  
    After removing the jar file from my web application,it shows the same error-servet-api.jar not loaded....nw what i do
  4. Anonymous Anonymous on June 02, 2010 9:41 AM  
    THANK YOU A LOT.... i removed that servelt-api.jar from my application and it worked!!!
  5. Hi,
    I'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.
  6. Anonymous Anonymous on December 03, 2010 3:25 PM  
    And another big thank you from here. Also kudos to dukeslittleb.
  7. Anonymous Anonymous on January 14, 2011 5:59 PM  
    Thank you! It has helped me a lot!
  8. Anonymous Anonymous on April 11, 2011 9:42 PM  
    Hi 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
  9. Anonymous rguenther on August 08, 2011 1:55 PM  
    I 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!
  10. Anonymous Anonymous on January 03, 2012 9:12 AM  
    thanks,
    it helped me
  11. Anonymous Anonymous on July 23, 2012 2:33 PM  
    hi
    as 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
  12. Anonymous Anonymous on August 10, 2012 3:16 AM  
    Thx you a lot !!
  13. Anonymous Anonymous on November 21, 2013 6:06 PM  
    This comment has been removed by a blog administrator.
  14. Anonymous Anonymous on November 23, 2013 2:18 PM  
    This comment has been removed by a blog administrator.
  15. This comment has been removed by a blog administrator.
ABOUT AUTHOR
Page Views :
Email :
PREVIOUS ARTICLES
Select Month:
TOP
Free counter and web stats