Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-191

Use correct class loader when passing a class to callNonInitConstructor in SerializingCloner

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.0.0.Beta4
    • None
    • Marshalling API
    • None

    Description

      When there is a shared object between a client (WAR) and server (EJB/EAR) and its class and parent class are part of a non-shared library (e.g., the class and parent class are present in both the client WAR and server EAR), the following exception occurs when SerializingCloner.clone is called on the object (note that the object class is Serializable and its parent class is not):

      Caused by: java.lang.IllegalArgumentException: No matching constructor
              at org.jboss.marshalling.reflect.SerializableClass.invokeConstructorNoException(SerializableClass.java:527)
              at org.jboss.marshalling.reflect.SerializableClass.callNonInitConstructor(SerializableClass.java:498)
              at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:246)
      

      The problem seems to be that cloneInfo.callNonInitConstructor ends up getting called using the parent class of the original object class instead of using the parent class of the cloned object class. Since the nonInitConstructors associated with cloneInfo won't have a key that matches the parent class of the original object class, the above exception occurs.

      Attachments

        Activity

          People

            fjuma1@redhat.com Farah Juma
            fjuma1@redhat.com Farah Juma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: