ObjectOutputStream sometimes uses the wrong classloader.
--------------------------------------------------------

                 Key: JRUBY-5142
                 URL: http://jira.codehaus.org/browse/JRUBY-5142
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.5.3
            Reporter: Rib Rdb


We use ObjectInputStream for unmarshaling java objects. ObjectInputStream uses 
latestUserDefinedLoader() to load classes:
{code:title=ObjectInputStream.java}
/**
 * Returns the first non-null class loader (not counting class loaders of
 * generated reflection implementation classes) up the execution stack, or
 * null if only code from the null class loader is on the stack.  This
 * method is also called via reflection by the following RMI-IIOP class:
 *
 *     com.sun.corba.se.internal.util.JDKClassLoader
 *
 * This method should not be removed or its signature changed without
 * corresponding modifications to the above class.
 */
// REMIND: change name to something more accurate?
private static native ClassLoader latestUserDefinedLoader();
{code}
Usually this ends up being the JRubyClassLoader and everything is happy. 
However sometimes we get a OneShotClassLoader and things blow up.

I created a subclass of ObjectInputStream which always tries using 
JRubyClassLoader:
http://github.com/jruby/jruby/pull/8

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to