1 Reply Latest reply on May 28, 2015 2:10 AM by Maciej Swiderski

    Is it possible to start process with a custom object parameter?

    chiaan Hung Novice

      I'm now use

      ksession.startProcess(processName, params);
      
      

      to start new processes.

      I want to use class as an elemnt of params map. But I use

      class_name b=(class_name)kcontext.getVariable("element");
      System.out.println("b.getType:"+b.print());
      
      

      to get the element in the script of bpmn2 file, the following error occures.

      17:51:28,641 ERROR [stderr] (Thread-127) Exception in thread "Thread-127" org.jbpm.workflow.instance.WorkflowRuntimeException: [defaultPackage.useCase7:109 - Script Task 1:2] -- [Error: null pointer: b.print()]
      17:51:28,641 ERROR [stderr] (Thread-127) [Near : {... System.out.println("b.getType:"+b.print()); ....}]
      17:51:28,641 ERROR [stderr] (Thread-127)                                 ^
      17:51:28,641 ERROR [stderr] (Thread-127) [Line: 42, Column: 20]
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:204)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:48)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:171)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:364)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:323)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:73)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:44)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:171)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:236)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:389)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:195)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:177)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:169)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1901)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:122)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:40)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:548)
      17:51:28,641 ERROR [stderr] (Thread-127)     at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:67)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:358)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:242)
      17:51:28,642 ERROR [stderr] (Thread-127)     at thread.sp.run(sp.java:114)
      17:51:28,642 ERROR [stderr] (Thread-127) Caused by: [Error: null pointer: b.print()]
      17:51:28,642 ERROR [stderr] (Thread-127) [Near : {... System.out.println("b.getType:"+b.print()); ....}]
      17:51:28,642 ERROR [stderr] (Thread-127)                                 ^
      17:51:28,642 ERROR [stderr] (Thread-127) [Line: 42, Column: 20]
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:450)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:163)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:117)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:971)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:396)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:163)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.mvel2.MVEL.executeExpression(MVEL.java:930)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.drools.core.util.MVELSafeHelper$RawMVELEvaluator.executeExpression(MVELSafeHelper.java:481)
      17:51:28,642 ERROR [stderr] (Thread-127)     at org.jbpm.process.instance.impl.MVELAction.execute(MVELAction.java:114)
      17:51:28,643 ERROR [stderr] (Thread-127)     at org.jbpm.workflow.instance.impl.NodeInstanceImpl.executeAction(NodeInstanceImpl.java:198)
      17:51:28,643 ERROR [stderr] (Thread-127)     ... 26 more
      17:51:28,643 ERROR [stderr] (Thread-127) Caused by: java.lang.NullPointerException
      17:51:28,643 ERROR [stderr] (Thread-127)     at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:416)
      17:51:28,643 ERROR [stderr] (Thread-127)     ... 44 more
      
      

      The problem occures because b not found.... Is it possible to startprocess with a custom object parameter? now I use jbpm 6.2.0.snapshot. THX!

      I know other version of jbpm can only use string as input params of startprocess function. Is version 6.2.0 able to do this?