You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/04/30 04:35:57 UTC

[Bug 57875] New: Classloading guide on Servlet API classes

https://bz.apache.org/bugzilla/show_bug.cgi?id=57875

            Bug ID: 57875
           Summary: Classloading guide on Servlet API classes
           Product: Tomcat 8
           Version: 8.0.21
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Documentation
          Assignee: dev@tomcat.apache.org
          Reporter: psfung@clustertech.com

https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html
The guide writes
Any JAR file that contains Servlet API classes will be explicitly ignored by
the classloader — Do not include such JARs in your web application.

I try including javaee-api-7.0.jar in my webapp in Tomcat 8. It contains
Servlet API classes as well as other JEE API such as JPA and JTA. My webapp
which depends on JPA and JTA runs normally, which implies the classes from
javaee-api-7.0.jar are loaded.

When the same webapp is deployed in Tomcat 7, the following error is shown and
my webapp failed to deploy because of NoClassDefFoundError of some JPA/JTA
class.
INFO:
validateJarFile(C:\apache-tomcat-7.0.54\webapps\ROOT\WEB-INF\lib\javaee-api-7.0.jar)
- jar not loaded.
See Servlet Spec 3.0, section 10.7.2. Offending class:
javax/servlet/Servlet.class

It appears that the classloader is changed in Tomcat 8 and that restriction is
lifted. If so, please update the guide accordingly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 57875] Classloading guide on Servlet API classes

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=57875

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 OS|                            |All
         Resolution|---                         |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report.

Tomcat 8 is more relaxed about this. It delegates first for all the JavaEE API
classes for the specs Tomcat implements. This achieves the same ends with less
impact on the user if they accidently ship an JavaEE API JAR in their web
application.

The updated docs will be in 8.0.23 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org