Discussion:
[jboss-user] [jBPM] - CommandBasedWSHumanTaskHandler null: java.io.OptionalDataException
Ouadi BEL
2013-03-27 15:49:27 UTC
Permalink
Ouadi BEL [https://community.jboss.org/people/ouadi_dev] created the discussion

"CommandBasedWSHumanTaskHandler null: java.io.OptionalDataException"

To view the discussion, visit: https://community.jboss.org/message/805069#805069

--------------------------------------------------------------
Hi,

When I want to complete a human task, this exception is triggered, and I'm not able to solve this situation :


17:17:46,192 ERROR [org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler] (NioProcessor-6) null: java.io.OptionalDataException
          at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1358) [rt.jar:1.7.0_15]
          at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) [rt.jar:1.7.0_15]
          at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler$GetResultContentResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:330) [jbpm-human-task-mina-5.4.0.Final.jar:5.4.0.Final]
          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:153) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
          at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47) [jbpm-human-task-mina-5.4.0.Final.jar:5.4.0.Final]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796) [mina-core-2.0.1.jar:]
          at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:427) [mina-core-2.0.1.jar:]
          at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:692) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:645) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:634) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:66) [mina-core-2.0.1.jar:]
          at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1078) [mina-core-2.0.1.jar:]
          at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64) [mina-core-2.0.1.jar:]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]
          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]


Here is my compete taskmethod code :


TaskClient client = null;

try {
      client = connectToTaskServer(TASK_SERVER_HOST_IP_ADD,
                                                  TASK_SERVER_PORT);

      BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();

     Map<String, Object> taskVariables = new HashMap<String, Object>();
     // Currency validation accepted

     taskVariables.put("o_validationResult", true);


      client.completeWithResults(aTaskId, aOwnerId, taskVariables, responseHandler);

      responseHandler.waitTillDone(2000);
 
      client.disconnect();


} catch (Exception e) {
    try {
          client.disconnect();
    } catch (Exception e1) {
         e1.printStackTrace();
    }
      e.printStackTrace();
      logger.error("Unable to completing the Task '" + aTaskId
                         + "' assigned to user '" + aOwnerId + "' : " + e.toString());
      throw new TaskManagerException("Unable to completing the Task '"
                         + aTaskId + "' assigned to user '" + aOwnerId + "' : "
                         + e.toString(), e);
}


After hard searching in the net, I'm not able to detect where this exception triggered !

Here is exception javadoc :

http://docs.oracle.com/javase/6/docs/api/java/io/OptionalDataException.html http://docs.oracle.com/javase/6/docs/api/java/io/OptionalDataException.html

Thanks for helps.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805069#805069]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Ouadi BEL
2013-03-28 16:16:00 UTC
Permalink
Ouadi BEL [https://community.jboss.org/people/ouadi_dev] created the discussion

"Re: CommandBasedWSHumanTaskHandler null: java.io.OptionalDataException"

To view the discussion, visit: https://community.jboss.org/message/805338#805338

--------------------------------------------------------------
I've find the solution of this probelm.

In order to solve this problem, we need to use this version of task complete method:


    BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
 
    Map<String, Object> taskVariables = new HashMap<String, Object>();
    taskVariables.put(new String("o_validationResult"),Boolean.valueOf(true));
 
    ContentData contentData = null;
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out;
    try {
      out = new ObjectOutputStream(bos);
      out.writeObject(taskVariables);
      out.close();
      contentData = new ContentData();
      contentData.setContent(bos.toByteArray());
      contentData.setAccessType(AccessType.Inline);
    } catch (IOException ioe) {
                 ioe.printStackTrace();
    }
 
    client.complete(aTaskId, aOwnerId, contentData, responseHandler);
 


With this code the task completion with a map of variables must done successfully.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/805338#805338]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...