DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31903>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31903

WebappClassLoader fails to load class form local repository





------- Additional Comments From [EMAIL PROTECTED]  2004-10-27 14:26 -------
This is a reproducible real problem.

Our server uses tomcat 5.0 as a servlet engine. When it runs multiple worker
threads to execute a JavaScritpt (using Rhino) on the server side, it will
occasionally but consistently throw NoClassDefFoundError on a class in Rhino
library, which is located in the WEB-INF\lib directory. 

We eventually figure out if two threads start to load same class concurrently
for WEB-INF/lib, one of them will fail if 

a) the first thread manages to call defineClass on the resource entry and set
the binaryContent to null; 

b) when the second adds its entry to the HashMap, it will find an entry for that
 class already exists, so it will return the existing entry (the one whose
binaryContent is null); 

For the second part, it has been reported by some other people. Please see the
following link

http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

It would be better to replace the code with single checked locking and make it
thread-safe.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to