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

ClassCastException occurs when mapping DMN output to a Java Object in a BPMN

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.56.0.Final
    • 7.45.0.Final
    • None
    • None

      When we call a DMN from a BPMN, we can pass in a Java object and it will map to a DMN type. However, when we return an object from a DMN and try to map it back to a Java option, we run into this exception: 

       {{Caused by: java.lang.ClassCastException: class java.util.HashMap cannot be cast to class com.myspace.exampleproject.MyDataObject (java.util.HashMap is in module java.base of loader 'bootstrap'; com.myspace.exampleproject.MyDataObject is in unnamed module of loader 'app')}}

      The output from the DMN is a HashMap, so we should be able to map that back to a Java Object which would make it easier to work with in the BPMN.

      I did some research, and I think this could be fixed here: https://github.com/kiegroup/jbpm/blob/master/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/RuleSetNodeInstance.java#L312

      By handling a case such as this where the instanceof checks against a HashMap, and uses either reflection or the Jackson Object Mapper to do the type conversion.

      I will start working on a fix, and open a PR soon. Any guidance is much appreciated!

       

       

              elguardian@gmail.com Enrique González Martínez (Inactive)
              hmatt1 Matt Hornung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: