3 Replies Latest reply on May 15, 2013 4:04 AM by Rajesh P

    Kindly help me in passing processVariables when Human Task completed.

    Rajesh P Newbie

      Hi All,

      Please some one give light on this problem. I am sstruggling to resolve this issue from last 2 days.

       

      I am using JBPM 5.4.0 final with Spring 3.0 MVC and Hibernate 3. I followed the configuration given in

       

      https://github.com/mswiderski/jbpm-examples/tree/master/jbpm-spring-web link.

       

       

      Actually when i passing the values to processVariales while human task is going to completed, i am getting null values inside of the script task after the human task.(Please find the attached BPMN file).

       

      The code i am using to complete the Human task is,

       

      long taskId = unlockRequestVO.getRequestID();

      humanTaskEngine.startTask(taskId,unlockRequestVO.getUser());

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

                          results.put("muRequest",unlockRequestVO);

                          if(unlockRequestVO.getTaskStatus().equals("approve"))

                          results.put("isApproved",true);

                          else

                                    results.put("isApproved", false);

      humanTaskEngine.completeWithResults(taskId, user, results);

       

      I have used the approach mentioned in the thread

      https://community.jboss.org/thread/220416

      But no use.

       

       

       

      Please let me where am i doing wrong?

       

      Please let me know if any information is required.

       

      java.lang.RuntimeException: Constraints must return boolean values: null for expression

                at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:136)

                at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:72)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)

                at org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55)

                at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)

                at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)

                at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)

                at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216)

                at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196)

                at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247)

                at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)

                at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemAborted(WorkItemNodeInstance.java:301)

                at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:287)

                at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)

                at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.abortWorkItem(JPAWorkItemManager.java:154)

                at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:56)

                at org.drools.command.runtime.process.AbortWorkItemCommand.execute(AbortWorkItemCommand.java:29)

                at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)

                at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.abortWorkItem(CommandBasedStatefulKnowledgeSession.java:156)

                at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:276)

                at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234)

                at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329)

                at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76)

                at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92)

                at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109)

                at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49)

                at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569)

                at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495)

                at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:83)

                at org.jbpm.task.service.local.LocalTaskService.completeWithResults(LocalTaskService.java:91)

                at com.honeywell.hses.workflow.WorkFlowService.approveOrReject(WorkFlowService.java:121)

                at com.honeywell.hses.workflow.WorkFlowService$$FastClassByCGLIB$$aec4f2ca.invoke(<generated>)

                at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

                at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)

                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)

                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

                at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)

                at com.honeywell.hses.workflow.WorkFlowService$$EnhancerByCGLIB$$ec946839.approveOrReject(<generated>)

                at com.honeywell.hses.workflow.WorkFlowProvider.approveOrRejectRequest(WorkFlowProvider.java:42)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                at java.lang.reflect.Method.invoke(Unknown Source)

                at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)

                at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)

                at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)

                at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)

                at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)

                at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)

                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

                at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:88)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

                at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

                at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

                at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)

                at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

                at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                at java.lang.Thread.run(Unknown Source)

      org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error

                at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:92)

                at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:494)

                at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:451)

                at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409)

                at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:385)

                at com.honeywell.hses.controller.MetricController.getRestServiceResult(MetricController.java:363)

                at com.honeywell.hses.controller.MetricController.approveOrRejectRequest(MetricController.java:457)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                at java.lang.reflect.Method.invoke(Unknown Source)

                at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)

                at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)

                at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)

                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)

                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)

                at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

                at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                at java.lang.Thread.run(Unknown Source)

       

      Thanks in advance.

       

      Rajesh,

        • 2. Re: Kindly help me in passing processVariables when Human Task completed.
          Shobhit Tyagi Master

          Rajesh,

           

          What I do is, rather than using completeWithResults(), I complete the task and set the variables like following :

           

           

          public void setProcessVariables(final long intProcessInstId, final Map<String, Object> hshVariableMap)

          {

            StatefulKnowledgeSession objKSession = BpmRepositoryConfig.createSession(); //Get the session. 

            try {

             objKSession.execute(new GenericCommand<Map<String, Object>>() {

              public Map<String, Object> execute(Context objContext) {

                     StatefulKnowledgeSession objKSession = ((KnowledgeCommandContext) objContext).

                                getStatefulKnowledgesession();

                     org.jbpm.process.instance.ProcessInstance objProcessInstance = (org.jbpm.process.instance.

                                     ProcessInstance) objKSession.

                                     getProcessInstance(intProcessInstId);

                     VariableScopeInstance objVariableScope = (VariableScopeInstance) objProcessInstance.

                                 getContextInstance(VariableScope.VARIABLE_SCOPE);

                     Iterator<Map.Entry<String, Object>> objIterator = hshVariableMap.entrySet().iterator();

                     while(objIterator.hasNext()) {

                      Map.Entry<String, Object> objPairs = (Map.Entry<String, Object>)objIterator.next();

                      objVariableScope.setVariable(objPairs.getKey(), objPairs.getValue());

                     }

                     return null;

                 }

             });

            } catch(Exception objException) {

             objLogger.loggerError(objException);

            }

          }

          1 of 1 people found this helpful
          • 3. Re: Kindly help me in passing processVariables when Human Task completed.
            Rajesh P Newbie

            Thanks a lot Shobhit Tyagi for your answer.

             

            I resolved this issue by implementing own LocalHTHandler as suggested in the below link

            https://community.jboss.org/thread/218281?start=0&tstart=0.

             

            Once again thank you very much Shobhit Tyagi. I will try your approach too.

             

             

            Thanks,

            Rajesh.