Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-6801

ClassCastException when trying to use Integer argument to service call

XMLWordPrintable

    • False
    • False
    • 2022 Week 08-10 (from Feb 21)

      Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
          at org.kie.kogito.handlers.AnsibleService_triggerJob_6_Handler.executeWorkItem(AnsibleService_triggerJob_6_Handler.java:20)
          at org.kie.kogito.handlers.AnsibleService_triggerJob_6_Handler_ClientProxy.executeWorkItem(Unknown Source)
          at org.jbpm.process.instance.LightWorkItemManager.internalExecuteWorkItem(LightWorkItemManager.java:80) 

      Generated service method:

      public void executeWorkItem(org.kie.kogito.internal.process.runtime.KogitoWorkItem workItem, org.kie.kogito.internal.process.runtime.KogitoWorkItemManager workItemManager) {
          service.triggerJob((java.lang.Integer) workItem.getParameter("jobId"), (java.lang.String) workItem.getParameter("workflowInstanceId"));
          workItemManager.completeWorkItem(workItem.getStringId(), java.util.Collections.emptyMap());
      } 

      Service interface

      public void triggerJob(Integer jobId, String workflowInstanceId) {
          System.out.println("workflowInstanceId = " + workflowInstanceId);
          System.out.println("jobId = " + jobId);
      } 

      SW service call definition:

      {
        "name": "ansibleAction",
        "functionRef": {
          "refName": "triggerAnsibleManually",
          "arguments": {
            "jobId": 7,
            "workflowInstanceId": "$CONTEXT.workflowInstanceId"
          }
        }
      } 

              ftirados Francisco Javier Tirado Sarti
              cnicolai@redhat.com Cristiano Nicolai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: