Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2703

Deserialization fails to work using custom Classloader

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 4.4
    • jBPM 4.2
    • Runtime Engine
    • None

      I am trying to use jBPM outside a servlet container and when storing a variable in the execution context, retrieving it I have:

      Caught: java.lang.ClassNotFoundException: Blah

      This is the same bug as described in:

      http://jira.codehaus.org/browse/GROOVY-1627 . I think this is the following issue as well: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4340158 .

      Java uses the last defined ClassLoader to loader the class. In many environments this might mean that the wrong class loader is chosen or that it works one day and the other day not.

      The following code fixes the problem (in org.jbpm.pvm.internal.type.converter.SerializableToBytesConverter line 71 in the revert method:

      ObjectInputStream ois = new ObjectInputStream(bais) {
      	   protected Class resolveClass(ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException {
      	       return Class.forName(objectStreamClass.getName(), true, Thread.currentThread().getContextClassLoader());
      	     }
      	   };
      

        1. jbpm-2703.patch
          1 kB
          Maciej Swiderski
        2. jbpm-2703-2010-05-08.patch
          10 kB
          HuiSheng Xu
        3. jbpm-2703-extended.patch
          11 kB
          Maciej Swiderski

              swiderski.maciej Maciej Swiderski (Inactive)
              pepite_jira Nicolas Leroux (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: