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


Alfonso Gonzalez del Riego <pipel...@gmail.com> changed:

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




--- Comment #8 from Alfonso Gonzalez del Riego <pipel...@gmail.com>  2009-02-18 
12:03:38 PST ---
Are you sure it is OK to synchronize around the call to
URLClassLoader.findClass?

If you have a page with 2 frames, each loading a JSP at the same time:

Thread T1 tries to load my.class.Foo
Thread T2 tries to load my.class.Foo

T1 calls WebappClassLoader.loadClass
T2 calls WebappClassLoader.loadClass

WebappClassLoader determines it has not loaded the class for both threads
(since there is no synchronization at this point).

Both T1 and T2 get to the synchronized block in findClass.
They get synchronized, but doing the wrong thing, and a LinkageError gets
thrown.

Don't you think that WebappClassLoader.loadClass(String, boolean) ought to be
synchronized just like it is in java.lang.ClassLoader?

I am actually running into this problem with Tomcat 5.5.27 (on a 4 core
machine):

Caused by: java.lang.LinkageError: loader (instance of 
org/apache/catalina/loader/WebappClassLoader): attempted  duplicate class
definition for name: "org/apache/struts/taglib/tiles/PutTag"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:904)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1353)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:125)
    at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) 
.... etc ....


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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