See Servlet Spec 2.3, section 9.7.2

If you are getting warnings or errors related with Servlet Specification, version 2.3, section 9.7.2. It means that you are trying to override web container’s implementation classes from your applications classes.
Servlet specification 2.3 section 9.7.2 says this clearly

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.

You can get away from these warnings by doing one of the following

1. server-api.jar is needed to compile an application and is not required in application war to run application as container already have this file. You must remove this file from WEB-INF/lib.

2. It can be because of other jar files that are bundled with container. e.g. j2ee.jar. You need to remove this file from your application’s lib directory.

In tomcat 6, $CATALINA_HOME/lib/ contains all the jar file which one should not override with those of application’s jar. tomcat 5 has these jars in $CATALINA_HOME/common/lib folder.

Related Post

See Servlet Spec 2.3, section 9.7.2
nested exception is java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher
javax.servlet.ServletException: javax.naming.NameNotFoundException: Name comp is not bound in this Context
nested exception is java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel /HSSFCellStyle
How to know which java version is installed in linux?

Comments

Leave a Reply