How to unmarshal REST payload to an Object in Rest Task in RHPAM

Updated 2018-12-20T01:36:56+00:00

Issue

  • I want to convert Rest json response to a process variable pojo object in Rest Task but I get the following Exception
15:03:46,048 ERROR [org.kie.server.remote.rest.jbpm.ProcessResource] (default task-7) Unexpected error during processing [myproj.myprocess:4 - REST:2] -- com.thoughtworks.xstream.io.StreamException: : org.jbpm.workflow.instance.WorkflowRuntimeException: [myproj.myprocess:4 - Rest:2] -- com.thoughtworks.xstream.io.StreamException: 
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:149)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:192)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:386)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:345)
    at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:60)
    at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:56)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:192)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:386)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:345)
    at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:72)
    at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43)
    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:192)
    at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:38)
    at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:233)
    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:476)
    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:210)
    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:193)
    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:185)
    at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1857)
    at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:122)
    at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:40)
    at org.drools.core.fluent.impl.PseudoClockRunner.executeBatch(PseudoClockRunner.java:102)
    at org.drools.core.fluent.impl.PseudoClockRunner.executeBatches(PseudoClockRunner.java:69)
    at org.drools.core.fluent.impl.PseudoClockRunner.execute(PseudoClockRunner.java:61)
    at org.drools.core.fluent.impl.PseudoClockRunner.execute(PseudoClockRunner.java:39)
    at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
    at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:597)
    at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:563)
    at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
    at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.internalExecute(OptimisticLockRetryInterceptor.java:102)
    at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:83)
    at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:44)
    at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
    at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73)
    at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:45)
    at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
    at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.internalExecute(ExecutionErrorHandlerInterceptor.java:66)
    at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:52)
    at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:29)
    at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:398)
    at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:66)
    at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:37)
    at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:41)
    at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:263)
    at org.jbpm.kie.services.impl.ProcessServiceImpl.startProcess(ProcessServiceImpl.java:114)
    at org.kie.server.services.jbpm.ProcessServiceBase.startProcess(ProcessServiceBase.java:95)
    at org.kie.server.remote.rest.jbpm.ProcessResource.startProcess(ProcessResource.java:142)
    ...
Caused by: org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException: com.thoughtworks.xstream.io.StreamException: 
    at org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:58)
    at org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler.handleException(AbstractLogOrThrowWorkItemHandler.java:39)
    at org.jbpm.process.workitem.rest.RESTWorkItemHandler.executeWorkItem(RESTWorkItemHandler.java:588)
    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:69)
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:140)
    ... 102 more
Caused by: com.thoughtworks.xstream.io.StreamException: 
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
    at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
    at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1337)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1328)
    at org.jbpm.process.core.datatype.impl.type.ObjectDataType.readValue(ObjectDataType.java:95)
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:300)
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:396)
    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:371)
    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:601)
    at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:167)
    at org.jbpm.process.workitem.rest.RESTWorkItemHandler.executeWorkItem(RESTWorkItemHandler.java:585)
    ... 104 more
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1) 
    at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
    ... 119 more

Environment

  • Red Hat Process Automation Manager
    • 7.1

Subscriber content preview. For full access to the Red Hat Knowledgebase, please log in.

Not a subscriber? Learn more about the benefits of Red Hat Subscriptions.