String respond = "SOME_VALUE";
Map result = new HashMap();
result.put("answer", respond);
ContentData contentData = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out;
try {
out = new ObjectOutputStream(bos);
out.writeObject(result);
out.close();
contentData = new ContentData();
contentData.setContent(bos.toByteArray());
contentData.setAccessType(AccessType.Inline);
} catch (IOException ioe) {
ioe.printStackTrace();
}
localTaskService.complete(taskId, userName, contentData);
My process has a sequence of human tasks.
When I ran the code above, the first task executed fine, but the second task gives me:
java.lang.String cannot be cast to org.jbpm.task.utils.MarshalledContentWrapper
Any idea why it suddently doesn't work?
Full stack trace:
Application Message - java.lang.String cannot be cast to org.jbpm.task.utils.MarshalledContentWrapper
java.lang.ClassCastException: java.lang.String cannot be cast to org.jbpm.task.utils.MarshalledContentWrapper
at org.jbpm.task.utils.ContentMarshallerHelper.unmarshall(ContentMarshallerHelper.java:157)
at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler$TaskCompletedHandler.handleCompletedTask(SyncWSHumanTaskHandler.java:354)
at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler$TaskCompletedHandler.execute(SyncWSHumanTaskHandler.java:329)
at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:307)
at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:73)
at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:46)
at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:502)
at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:468)
at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:80)