1 Reply Latest reply on Dec 12, 2003 11:23 AM by Barry M. Caceres

    Deserialization Broken for java.lang.Class for RMI calls

    Barry M. Caceres Newbie

      It appears that the code that handles deserialization
      of method parameters in RMI calls is failing to properly
      deserialize instances of java.lang.Class. This occurs when I call
      an EJB methods remotely and not during any other serialization or
      deserialization (i.e.: I could not replicate this when serializing
      the object to a ByteArrayOutputStream and then deserializing from
      a ByteArrayInputStream -- I also tried with a FileOutputStream and
      FileInputStream and could not reproduce the behavior).

      The bug manifests itself when trying to deserialize java.lang.Integer.TYPE
      which represents the "int" primitive type as a java.lang.Class object.
      (I imagine the bug would also appear if deserializing Float.TYPE,
      Double.TYPE, or any other primitive TYPE constant).

      It appears that the deserialization is attempting to perform a
      Class.forName(String) on "int", which then fails with a message about
      there being no class loaders for class "int".

      The primitive types should be a special case in the
      deserialization method and looked up in a table.

      Like I said, this only occurs when I try to send Integer.TYPE over
      the wire to an EJB remote method call (not during deserialization
      from a ObjectInputStream based on a ByteArrayInputStream or
      FileInputStream)

      From the stack trace it looks like the problem is actually in the
      org.jboss.invocation.MarshalledValueInputStream class.

      Any help with this matter would be great (especially info on how to
      fix it in my local 3.2.1 & 3.2.2 source code).

      Here is the stack-trace snippet....

      15:22:39,841 ERROR [STDERR] java.lang.ClassNotFoundException: No
      ClassLoaders found for: int
      15:22:39,843 ERROR [STDERR] at
      org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:241)
      15:22:39,843 ERROR [STDERR] at
      org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:169)
      15:22:39,843 ERROR [STDERR] at
      org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:123)
      15:22:39,844 ERROR [STDERR] at
      java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      15:22:39,844 ERROR [STDERR] at
      org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
      15:22:39,844 ERROR [STDERR] at
      org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:78)
      15:22:39,844 ERROR [STDERR] at
      java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      15:22:39,844 ERROR [STDERR] at
      org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
      15:22:39,845 ERROR [STDERR] at
      java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      15:22:39,845 ERROR [STDERR] at
      java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      15:22:39,845 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
      15:22:39,845 ERROR [STDERR] at java.lang.Class.forName(Class.java:219)
      15:22:39,845 ERROR [STDERR] at
      org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:95)
      15:22:39,845 ERROR [STDERR] at
      java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
      15:22:39,846 ERROR [STDERR] at
      java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      15:22:39,846 ERROR [STDERR] at
      java.io.ObjectInputStream.readClass(ObjectInputStream.java:1402)
      15:22:39,846 ERROR [STDERR] at
      java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1260)
      15:22:39,846 ERROR [STDERR] at
      java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
      15:22:39,846 ERROR [STDERR] at
      java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
      15:22:39,847 ERROR [STDERR] at
      java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
      15:22:39,847 ERROR [STDERR] at
      java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      15:22:39,847 ERROR [STDERR] at
      java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
      15:22:39,847 ERROR [STDERR] at
      java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:452)
      ...