简体   繁体   中英

Class cast exception when invoking JBPM process through REST API and passing in custom object

I have downloaded JBPM business application template from http://start.jbpm.org . I have added a custom data model in the model project and gave reference to the same in the kjar and service projects. I imported the project into the controller and then created a process with the custom object being one of the process input variables. Then I fetched the bpmn process into code through git pull process as per documentation. The project got built and deployed successfully. However, when I try to create the process instance, it is giving me a class cast exception. My data model implements the java.io.Serializable interface and has a public constructor. I am not able to find a solution in the documentation regarding this. Any help or pointers to a solution would help.

I have tried changing the input JSON formats which I post to create the process instances.

{
  "employee": {
    "lastName": "Sample1",
    "firstName": "Sample2",
    "employeeId": 1
  }
}

I tried adding in type information in the JSON, but it did not work.

The REST API is being called through POSTMAN utility and there is no client code written as of now.

Unable to create response: [soap-client-kjar.OtherProcess:9 - LogAndSetupData:2] -- java.util.LinkedHashMap cannot be cast to com.test.Employee

  • The user-defined class definition must implement a no-arg constructor.
  • The class definition must be included in the deployment jar (kjar) of the deployment that the command (request) is sent to.
  • The class must implement java.io.Serializable.
  • These classes must also be annotated with one of the following type annotations: org.kie.api.remote.Remotable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM