Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4424229

Java V2 Beta Rev 1.4 -- Hashtable Deserialization ClassNotFoundException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1 P1
    • None
    • solaris_9
    • core-libs
    • None

      Using Solaris 9 build 34 nightly Java: fullversion "1.4.0-beta-b55", the
      following exception occurs when trying to run Web Start Wizard 3.0 based
      wizards. Tried several config and install wizards, they all produced
      this type of Java exception trace and would not run.

      The base OS system used was Solaris 9 build 33. The above Java via its
      SUNWj3rt package was added to the S9 build 33 system for this test. To
      duplicate, this package can be found at ...
      /net/paradise.eng/export/integrate_dock/s9s_wos/sparc/SUNWj3rt

      -------------------------------------------------------
      #java sysid
      Could not find class during deserialization of the WizardState:java.lang.ClassNotFoundException: com.sun.sysid.core.SysIDServerObject
      java.lang.ClassNotFoundException: com.sun.sysid.core.SysIDServerObject
              at java.lang.ClassLoader.findClass(ClassLoader.java:353)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:304)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:260)
              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:201)
              at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:492)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1377)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1300)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1501)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1164)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:283)
              at java.util.Hashtable.readObject(Hashtable.java:797)
              at sun.misc.Unsafe.invokeSpecial(Native Method)
              at sun.misc.ClassReflector.invokeSpecial(ClassReflector.java:390)
              at $ClassReflector2.readObject(Unknown Source)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1597)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1520)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1164)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:283)
              at com.sun.wizards.core.GenericWizardState.setWizardState(GenericWizardState.java:1762)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:30)
              at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAccessorImpl.java:46)
              at java.lang.reflect.Method.invoke(Method.java:306)
              at com.sun.wizards.core.ArchiveReader.callObjectMethod(ArchiveReader.java:1283)
              at com.sun.wizards.core.ArchiveReader.<init>(ArchiveReader.java:272)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:33)
              at sun.reflect.InflatableConstructorAccessorImpl.newInstance(InflatableConstructorAccessorImpl.java:38)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:273)
              at sysid.instantiateArchiveReader(ArchiveClassLoader.java:192)
              at sysid.<init>(ArchiveClassLoader.java:142)
              at sysid.main(ArchiveClassLoader.java:1190)
      --------------------------------------------------------------------------------



      paul.lovvik@eng 2001-03-20
      I have created a small test program that clearly demonstrates the problem.

      The problem seems to be in the deserialization of a java.lang.Hashtable
      object. It seems that the default ClassLoader is being used to load
      all of the classes for values stored in the Hashtable. If the default
      ClassLoader is not able to find the necessary classes, a ClassNotFoundException
      will be thrown.

      My attached example program works well under Java 1.1 -> Java 1.3. On
      Java 1.4, it fails with the following stack trace:

      java.lang.ClassNotFoundException: CustomString
              at java.lang.ClassLoader.findClass(ClassLoader.java:353)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:304)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:260)
              at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:201)
              at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:492)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1377)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1300)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1501)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1164)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:283)
              at java.util.Hashtable.readObject(Hashtable.java:797)
              at sun.misc.Unsafe.invokeSpecial(Native Method)
              at sun.misc.ClassReflector.invokeSpecial(ClassReflector.java:390)
              at $ClassReflector0.readObject(Unknown Source)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1597)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1520)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1164)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:283)
              at MainClass.readStreamBytes(MainClass.java:70)
              at MainClass.runTest(MainClass.java:27)
              at MainClass.main(MainClass.java:81)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:30)
              at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAccessorImpl.java:46)
              at java.lang.reflect.Method.invoke(Method.java:306)
              at FileClassLoader.main(FileClassLoader.java:151)
      result=test failed.

      In the test that generated this stack trace, an instance of CustomString
      (which was loaded with a custom ClassLoader) is put into a Hashtable,
      the Hashtable is serialized, and then deserialized.

      It seems that Hashtable.readObject has changed behavior from Java 1.3 to
      Java 1.4, which is the core of our problem.

      I have also tried using a Vector to see if it fails in a similar way. It
      does not.
      paul.lovvik@eng 2001-03-20

            mwarressunw Michael Warres (Inactive)
            johperry John M Perry (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: