1 2 Previous Next 20 Replies Latest reply on Mar 29, 2013 1:56 PM by ouadi_dev

    How to set a process variable from java code ?

    ouadi_dev

      Hi, 

       

      In my web application using a jBPM5 process, after starting my process (with a collection of process variables) and completing some tasks, when the process execution achieve a "Gateway", the process engine need to have a value of a process variable in order to continue the process execution flow.

       

      How I can pass the value of this process variable to process execution from a java class code ?

       

      Thanks in advance,

        • 1. Re: How to set a process variable from java code ?
          joploya

          Hello,

           

          You need to retrieve the WorkflowProcessInstance : (WorkflowProcessInstance)kSession.getProcessInstance(processInstanceId);

          Then :  workflowProcessInstance.setVariable("formValid", formValid);

           

          But after server restart workflowProcessInstance can be null and I don't find how to solve this problem.

          • 2. Re: How to set a process variable from java code ?
            roxy1987

            Use this code when completing a task :

             

            client.start(id, user)

            Map<String, Object> var= new HashMap<String, Object>();

            firstHtOutputMap.put("variable", "value");

             

            ContentData contentData = ContentMarshallerHelper.marshal(var, null);

            client.complete(id, user, contentData);

             

            Create the variable in process definition as well. And map it with the parameter in the human task.

            • 3. Re: How to set a process variable from java code ?
              swiderski.maciej

              you can find information about how to access process variables (and similarly alter them) in the documentation.

               

              HTH

              • 4. Re: How to set a process variable from java code ?
                ouadi_dev

                Thanks all for reply.

                 

                But after using your suggestions, this ERROR appeare :

                 

                ERROR [org.drools.persistence.SingleSessionCommandService] (NioProcessor-6) Could not commit session: org.jbpm.workflow.instance.WorkflowRuntimeException: [workflowMakerCheckerV1:80 - Est valider:7] -- Exception when trying to evaluate constraint No in split Est valider

                          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:309) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                          at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69) [drools-core-5.5.0.Final.jar:5.5.0.Final]

                          at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32) [drools-core-5.5.0.Final.jar:5.5.0.Final]

                          at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-5.5.0.Final.jar:5.5.0.Final]

                          at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]

                          at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150) [drools-core-5.5.0.Final.jar:5.5.0.Final]

                          at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:307) [jbpm-human-task-mina-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81) [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]

                Caused by: java.lang.RuntimeException: Exception when trying to evaluate constraint No in split Est valider

                          at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:79) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          ... 40 more

                Caused by: java.lang.RuntimeException: unable to execute ReturnValueEvaluator:

                          at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:132) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:72) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          ... 41 more

                Caused by: java.lang.NullPointerException

                          at s2mPackage.Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bf.returnValueEvaluator5(Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bf.java:38)

                          at s2mPackage.Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bfReturnValueEvaluator5Invoker.evaluate(Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bfReturnValueEvaluator5Invoker.java:15)

                          at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:130) [jbpm-flow-5.4.0.Final.jar:5.4.0.Final]

                          ... 42 more

                 

                 

                00:18:35,572 ERROR [stderr] (NioProcessor-6) org.jbpm.workflow.instance.WorkflowRuntimeException: [workflowMakerCheckerV1:80 - Est valider:7] -- Exception when trying to evaluate constraint No in split Est valider

                00:18:35,580 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)

                00:18:35,580 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)

                00:18:35,581 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)

                00:18:35,581 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)

                00:18:35,582 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216)

                00:18:35,589 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196)

                00:18:35,590 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247)

                00:18:35,590 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)

                00:18:35,591 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:309)

                00:18:35,595 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)

                00:18:35,596 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)

                00:18:35,596 ERROR [stderr] (NioProcessor-6)           at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:121)

                00:18:35,604 ERROR [stderr] (NioProcessor-6)           at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)

                00:18:35,614 ERROR [stderr] (NioProcessor-6)           at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)

                00:18:35,616 ERROR [stderr] (NioProcessor-6)           at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                00:18:35,617 ERROR [stderr] (NioProcessor-6)           at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

                00:18:35,617 ERROR [stderr] (NioProcessor-6)           at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

                00:18:35,618 ERROR [stderr] (NioProcessor-6)           at org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(CommandBasedWSHumanTaskHandler.java:307)

                00:18:35,620 ERROR [stderr] (NioProcessor-6)           at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:81)

                00:18:35,622 ERROR [stderr] (NioProcessor-6)           at org.jbpm.task.service.mina.MinaTaskClientHandler.messageReceived(MinaTaskClientHandler.java:47)

                00:18:35,623 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:716)

                00:18:35,623 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                00:18:35,632 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                00:18:35,632 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)

                00:18:35,643 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:427)

                00:18:35,644 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:245)

                00:18:35,644 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                00:18:35,645 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)

                00:18:35,646 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)

                00:18:35,649 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)

                00:18:35,650 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)

                00:18:35,655 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)

                00:18:35,656 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:692)

                00:18:35,658 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:645)

                00:18:35,658 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:634)

                00:18:35,659 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:66)

                00:18:35,659 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1078)

                00:18:35,660 ERROR [stderr] (NioProcessor-6)           at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

                00:18:35,663 ERROR [stderr] (NioProcessor-6)           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                00:18:35,663 ERROR [stderr] (NioProcessor-6)           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                00:18:35,664 ERROR [stderr] (NioProcessor-6)           at java.lang.Thread.run(Thread.java:722)

                00:18:35,665 ERROR [stderr] (NioProcessor-6) Caused by: java.lang.RuntimeException: Exception when trying to evaluate constraint No in split Est valider

                00:18:35,666 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:79)

                00:18:35,666 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)

                00:18:35,667 ERROR [stderr] (NioProcessor-6)           ... 40 more

                00:18:35,668 ERROR [stderr] (NioProcessor-6) Caused by: java.lang.RuntimeException: unable to execute ReturnValueEvaluator:

                00:18:35,669 ERROR [stderr] (NioProcessor-6)           at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:132)

                00:18:35,671 ERROR [stderr] (NioProcessor-6)           at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:72)

                00:18:35,672 ERROR [stderr] (NioProcessor-6)           ... 41 more

                00:18:35,672 ERROR [stderr] (NioProcessor-6) Caused by: java.lang.NullPointerException

                00:18:35,672 ERROR [stderr] (NioProcessor-6)           at s2mPackage.Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bf.returnValueEvaluator5(Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bf.java:38)

                00:18:35,676 ERROR [stderr] (NioProcessor-6)           at s2mPackage.Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bfReturnValueEvaluator5Invoker.evaluate(Process_s2mPackage_Proposition_and_validation_or_ignore_new_currency_e94d9a99449f45b497de249c5379a3bfReturnValueEvaluator5Invoker.java:15)

                00:18:35,677 ERROR [stderr] (NioProcessor-6)           at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:130)

                 

                 

                This is the GateWay "Est valider" constrainte :

                 

                GateWay.png

                 

                Yes :

                 

                GateWay_2.png

                 

                No :

                 

                GateWay_3.png

                 

                HumanTask Result Mapping config :

                 

                param.png

                 

                Java code that set the task variable in order to copy it in process variable in order to continue the process flow execution is :

                 

                 

                Map<String, Object> taskVariables = new HashMap<String, Object>();
                // Currency validation accepted
                taskVariables.put("o_validationResult", true);
                ContentData contentData = ContentMarshallerHelper.marshal(taskVariables, null);
                //
                boolean isCompleted = taskClientManager.completeTask(taskIdAssociatedToActualCurrency, loggedInUser, contentData);
                

                 

                Where is the problem please !

                • 5. Re: How to set a process variable from java code ?
                  ouadi_dev

                  Any help please ?

                  • 6. Re: How to set a process variable from java code ?
                    swiderski.maciej

                    could you upload your bpmn2 file so we could check if it has proper mapping?

                    • 7. Re: How to set a process variable from java code ?
                      ouadi_dev

                      Here it is,

                       

                      But I assume that the problem is "p_isCurrencyValidated" process variable is NULL, but why ???

                       

                      Thanks

                      • 8. Re: How to set a process variable from java code ?
                        ouadi_dev

                        Here is how I start my process :

                         

                        private static Map<String, Object> initialParams = new HashMap<String, Object>();
                        initialParams.put("p_userAutentified", "maker");
                        
                        // Starting a process instance
                        ksession.startProcess("workflowMakerCheckerV1", initialParams);
                        logger.info("Process was successfully strated");
                        
                        
                        • 9. Re: How to set a process variable from java code ?
                          swiderski.maciej

                          ok, looking at your process definition seems like you don't map properly task output to the process variable. On "check the new currency" you map Result to the variable but according to your previous post you use another name for task completion - "o_validationResult"

                           

                          So make sure you provide the right values for the mapping and when completing the task and you should be good to go.

                           

                          HTH

                          • 10. Re: How to set a process variable from java code ?
                            ouadi_dev

                            So, I'm sorry, I have changing my workflow configuration since this morning;

                             

                            So, I'm rolling back all the changes in order to have the same configuration described in my previouse post with screen prints.

                             

                            Now, my BPMN2 file is updated above.

                             

                            You can check it now.

                             

                            Thanks for your helps.

                            • 11. Re: How to set a process variable from java code ?
                              swiderski.maciej

                              could you attach both, process definition (bpmn2) and code that you use to start and complete tasks.

                              • 12. Re: How to set a process variable from java code ?
                                ouadi_dev

                                After verifing the code that complete the task, I find that I forget passing the DataContent parameter in the complete method :

                                 

                                Old code :

                                 

                                client.complete(aTaskId, aOwnerId, null, responseHandler);
                                

                                 

                                Correct code :

                                 

                                client.complete(aTaskId, aOwnerId, contentData, responseHandler);
                                

                                 

                                But after executing my process, this error appears :

                                 

                                 

                                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]
                                
                                

                                 

                                Thank you very much for your high-professional and pointed response.

                                • 13. Re: How to set a process variable from java code ?
                                  swiderski.maciej

                                  since you use 5.4 you could make use of client.completeWithResults method so you don't need to deal with marshalling of data. With that method you simply give the map with output parameters as results and it will do the required marshalling.

                                   

                                  HTH

                                  • 14. Re: How to set a process variable from java code ?
                                    ouadi_dev

                                    So, how I can solve this problem ?

                                    1 2 Previous Next