See Servlet Spec 2.3, section 9.7.2

validateJarFile (C:\jboss\server\default\.\tmp\deploy\tmp49777abc-exp.war\WEB-INF\lib
\servlet.jar) – jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

I guess this is the most modest and informative error i have come through. This generally happen when you deploy your war file and start the server. Now lets follow the instructions given in error and read through the section 9.7.2.

The classloader that a container uses to load a servlet in a WAR must allow the
developer to load any resources contained in library JARs within the WAR
following normal J2SE semantics using getResource. It must not allow theWAR to
override J2SE or Java servlet API classes. It is further recommended that the loader
not allow servlets in theWAR access to the web container’s implementation classes.
It is recommended also that the application class loader be implemented so
that classes and resources packaged within the WAR are loaded in preference to
classes and resources residing in container-wide library JARs.

The problem is that you are having some of the jar files which are not supposed to be in your war but in container(tomcat) e.g. servlet.jar. It is very common mistake to keep these jars in WEB-INF/lib folder for compilation and ship it with the war file.

Check whether you have any jar files which are not supposed to be with war file but in container’s lib directory.

Most Commented Posts

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

thanks. it do help.

Thanks Zhao for your comment.

This solves my problem, thanks Aditya.

Thanks joseph for your comment. I wrote it down only because this mistake we generally do while developing web in Java.

Hi,

If the problem has occured during building the Maven POM then you just need to set the tag under to “provide”.

tomcat
servlet-api
5.5.23
provided

good site nuladx

Helpful.
Thanks.

Thanks for your comment man!

Hey when I deployed the java application and run on Tomcat I got the following error. Plz let me know what the error is
Thanks in advance
java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)

thank… i also had the same problem while developing a web service using Axis 2. this help me a lot to solve the problem. because there were some unwanted jar in Axis’s lib folder which already exists in the lib folder of tomcat. so i removed the unwanted jars from the axis’s lib folders.

Leave a comment

(required)

(required)