https://issues.apache.org/bugzilla/show_bug.cgi?id=55943

Konstantin Kolinko <knst.koli...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #13 from Konstantin Kolinko <knst.koli...@gmail.com> ---
(In reply to Mark Thomas from comment #6)

The essential bit of r1559153 / r1559134 is the following change:

@@ -1186,9 +1200,9 @@ public class WebappClassLoader extends U
         // (0.2) Try loading the class with the system class loader, to
prevent
         //       the webapp from overriding J2SE classes
         String resourceName = binaryNameToPath(name, false);
-        if (system.getResource(resourceName) != null) {
+        if (j2seClassLoader.getResource(resourceName) != null) {
             try {
-                clazz = system.loadClass(name);
+                clazz = j2seClassLoader.loadClass(name);

The old code used 'System' classloader - the JVM CLASSPATH.
The new code uses 'Bootstrap' classloader - the topmost non-null parent of
System class loader - the one that provides Java SE core classes.

As such, class-loader-howto,html has to be corrected.
The classes lookup order in 7.0.50 and earlier is:

 *  Bootstrap classes of your JVM
 *  System class loader classes (described above)
 *  /WEB-INF/classes of your web application
 *  /WEB-INF/lib/*.jar of your web application
 *  Common class loader classes (described above)

For 8.0.0 and 7.0.52 and later it now is

 *  Bootstrap classes of your JVM
 *  /WEB-INF/classes of your web application
 *  /WEB-INF/lib/*.jar of your web application
 *  System class loader classes (described above)
 *  Common class loader classes (described above)

I am REOPENING this issue to apply this documentation fix. It is worth noting
this in migration guide.

It may be worth to add that if one configures <Loader delegate="true"/>,
the above order becomes

 *  Bootstrap classes of your JVM
 *  System class loader classes (described above)
 *  Common class loader classes (described above)
 *  /WEB-INF/classes of your web application
 *  /WEB-INF/lib/*.jar of your web application


One use case when jar is added by Java to the system classloader is using
-javaagent option.
Documentation:
http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-summary.html#package_description

A thread:
http://tomcat.markmail.org/thread/trd7yj46qajqra2v
Of course, such jar files should not be in WEB-INF/lib directory.

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

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

Reply via email to