Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1417

MarshallingException occurs during REST request (JSON) unmarshalling in KIE server.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.9.0.GA
    • 7.7.1.GA
    • Kie-Server
    • User's environment is RHDM 7.7.1 Kie Server on EAP 7.2.6.

    • 3
    • Release Notes
    • CR1
    • +
    • Hide

      Steps to Reproduce

      1. Install RHDM 7.7.1 Kie Server on EAP 7.2.6. No controller needed.
      2. Build reproducer and deploy decision service.
        $ unzip reproducer_02699633_1.zip
        $ cd reproducer_02699633_1
        $ mvn clean install
        $ cd reproducer-service
        $ mvn kieserver:deploy    # Use "mvn kieserver:dispose" when you need to undeploy the service.
        
      3. Send REST request.
        $ cd reproducer_02699633_1/client
        $ ./request1.sh
        

      Note: The issue reproduces when ContactParam is in kjar and IRuleParam is in the module jar, on the other hand the issue does not reproduce when both ContactParam and IRuleParam are contained in the same module jar (See Step A) or in the same kjar (See Step B).

      Step A (in the same library):

      1. Move src/main/java/com/example/reproducer/common/params in reproducer-service (kjar) to the same path in reproducer-common (library).
      2. Build reproducer-service and redeploy (dispose and deploy) the service.
      3. Send the REST request using request1.sh.

      Step B (in the same kjar):

      1. Move src/main/java/com/example/reproducer/common/base in reproducer-common (library) to the same path in reproducer-service (kjar).
      2. Build reproducer-service and redeploy (dispose and deploy) the service.
      3. Send the REST request using request1.sh.
      Show
      Steps to Reproduce Install RHDM 7.7.1 Kie Server on EAP 7.2.6. No controller needed. Build reproducer and deploy decision service. $ unzip reproducer_02699633_1.zip $ cd reproducer_02699633_1 $ mvn clean install $ cd reproducer-service $ mvn kieserver:deploy    # Use "mvn kieserver:dispose" when you need to undeploy the service. Send REST request. $ cd reproducer_02699633_1/client $ ./request1.sh Note: The issue reproduces when ContactParam is in kjar and IRuleParam is in the module jar, on the other hand the issue does not reproduce when both ContactParam and IRuleParam are contained in the same module jar (See Step A) or in the same kjar (See Step B). Step A (in the same library): Move src/main/java/com/example/reproducer/common/params in reproducer-service (kjar) to the same path in reproducer-common (library). Build reproducer-service and redeploy (dispose and deploy) the service. Send the REST request using request1.sh. Step B (in the same kjar): Move src/main/java/com/example/reproducer/common/base in reproducer-common (library) to the same path in reproducer-service (kjar). Build reproducer-service and redeploy (dispose and deploy) the service. Send the REST request using request1.sh.

      A user's decision service deployed on KIE server receives REST commands from client, MarshallingException due to class loading failure occurs during JSON unmarshalling before the commands are processed. I attached a simplified reproducer reproducer_02699633_1.zip expressing the issue, and the error message is like below:

      Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'com.example.reproducer.common.params.ContactParam' as a subtype of [simple type, class com.example.reproducer.common.base.IRuleParam]: no such class found
      at [Source: (String)"{  "lookup" : "ksession-rules",  "commands" : [ {    "insert" : {      "object" : {        "com.example.reproducer.common.base.Fact1": {          "parameter" : {            "@class" : "com.example.reproducer.common.params.ContactParam",            "contactInfo" : 123456789          }        }      }    }  },  { "fire-all-rules" : "" }  ]}"; line: 1, column: 185] (through reference chain: org.drools.core.command.runtime.BatchExecutionCommandImpl["commands"]->java.util.ArrayList[0]->org.drools.core.command.runtime.rule.InsertObjectCommand["object"]->com.example.reproducer.common.base.Fact1["parameter"])
      

      For full error messages, see full_error_messages.txt in Attachment.

      The user's decision service (kjar) uses classes in another module jar as a library. ContactParam class which is a sub type of IRuleParam interface is in the kjar and IRuleParam interface is in the module jar.
      Also, @JsonTypeInfo(use = Id.CLASS) annotation is given to IRuleParam like below in order for JSON implementation to recognize a given class to Fact1.parameter as a sub type of IRuleParam.

      @JsonTypeInfo(use = Id.CLASS)
      public interface IRuleParam {
      }
      

      Both classes contained in the module jar and classes in the kjar should be loaded.

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-myoshida Masato Yoshida
              Karel Suta Karel Suta
              Karel Suta Karel Suta
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: