3 Replies Latest reply on Aug 14, 2006 1:27 PM by Clebert Suconic

    Why JBossSerialization doesn't work on JRockit 1.4

    Clebert Suconic Master

      In Serialization there are two things that are very basic for

      - Use of Ghost Constructors (this is just a name that I gave it)
      A Serializable class doesn't need to implement a DefaultConstructor.
      The default constructor for the next NonSerializableClass on the hierarchy is going to be used, but the constructor is then modified to return an instance of the Serializable Class.
      That's why I call it GhostConstrutor. Usually what happens is java.lang.Object's constructor returning an user's instance.
      I have this implemented on ConstructorManager (The code decides what Manager to use)
      The default manager uses sun.reflect.ReflectionFactory. Look at this Bug to a request on opening this feature in a standard way:


      - Change of final fields
      In JVM 1.5 this is not a problem. I can do this through Reflection by simply setting accessible to true. Lots of XML parses are using such thing.
      But on JVM 1.4, sun.misc.Unsafe is the only safe way to do it.
      Again, this is implemented through FieldsManager, and I always test on what's supported before starting.

      These are two hooks I need on the JVM that are extra to the regular reflection layer to perform serialization.

      Now there is a problem on JRockit. I can't get an instance of either Unsafe or ReflectionManager. Something is not giving me the right to get access to these instances. At first I was getting "some DLL not found".
      Then I forced the DLL on LD_LIBRAR_PATH (or Path if Windows) and still didn't get it working.

      I would need to look at source code for ways to get access to that hook on JRockit. As I didn't have such thing I just gave up and decided to not support JRockit 1.4. (JBossSerialization at first was only planned for 1.5+, 1.4 was a plus already).

      Also, if we need to port JBossSerialization to other JVMs (like Harmany in a near future, or GCJ), we will need these hooks. (Assuming SoftReferences, WeakReferences and Reflection works)


      Clebert Suconic