2 Replies Latest reply on Oct 2, 2014 3:51 AM by Laura delli Paoli

    Unable to complete a workitem using REST API (Per-Process-Instance Runtime strategies)

    Laura delli Paoli Master

      Hi,

      I have jBPM6 deployment and since I need to have more processes in execution at the same time I was trying to configure per-process deployment startegy.

      My processes include tasks that are completed outside from jBPM (using REST API). With Singleton and per-request strategies all worked fine, but, when I use per-process startegy, when I try to complete process (I added runtimeProcInstId parameter with value the process Instance Id of the process to complete) I get the following warn from jBPM and my rest call fails with a 500 status CODE (Internal Server Error).

       

       

       

       

      12:05:34,649 WARN  [org.drools.persistence.SingleSessionCommandService] (http-localhost-10.21.30.71-8080-1) Could not commit session: java.lang.IllegalStateException: Invalid session was used for this context org.kie.internal.runtime.manager.context.ProcessInstanceIdContext@572fa89d

        at org.jbpm.runtime.manager.impl.PerProcessInstanceRuntimeManager.validate(PerProcessInstanceRuntimeManager.java:138) [jbpm-runtime-manager-6.0.1.Final.jar:6.0.1.Final]

        at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:89) [jbpm-persistence-jpa-6.0.1.Final.jar:6.0.1.Final]

        at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:264) [jbpm-flow-6.0.1.Final.jar:6.0.1.Final]

        at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:260) [jbpm-flow-6.0.1.Final.jar:6.0.1.Final]

        at org.drools.core.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1598) [drools-core-6.0.1.Final.jar:6.0.1.Final]

        at org.drools.core.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:339) [drools-core-6.0.1.Final.jar:6.0.1.Final]

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

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

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

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

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.1.Final.jar:6.0.1.Final]

        at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:527) [drools-persistence-jpa-6.0.1.Final.jar:6.0.1.Final]

        at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.0.1.Final.jar:6.0.1.Final]

        at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:73) [drools-persistence-jpa-6.0.1.Final.jar:6.0.1.Final]

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

        at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:498) [drools-core-6.0.1.Final.jar:6.0.1.Final]

        at org.kie.services.remote.rest.RestProcessRequestBean.doKieSessionOperation(RestProcessRequestBean.java:61) [kie-services-remote-6.0.1.Final.jar:6.0.1.Final]

        at org.kie.services.remote.rest.RestProcessRequestBean$Proxy$_$$_WeldClientProxy.doKieSessionOperation(RestProcessRequestBean$Proxy$_$$_WeldClientProxy.java) [kie-services-remote-6.0.1.Final.jar:6.0.1.Final]

        at org.kie.services.remote.rest.RuntimeResource.worktiem_workItemId_oper(RuntimeResource.java:239) [kie-services-remote-6.0.1.Final.jar:6.0.1.Final]

        at org.kie.services.remote.rest.RuntimeResource$Proxy$_$$_WeldClientProxy.worktiem_workItemId_oper(RuntimeResource$Proxy$_$$_WeldClientProxy.java) [kie-services-remote-6.0.1.Final.jar:6.0.1.Final]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_35]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_35]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_35]

        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]

        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [solder-impl-3.2.1.Final.jar:3.2.1.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74) [solder-impl-3.2.1.Final.jar:3.2.1.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.jbpm.designer.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:70) [jbpm-designer-backend-6.0.1.Final.jar:6.0.1.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266) [uberfire-security-server-0.3.1.Final.jar:0.3.1.Final]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.13.Final.jar:]

        at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:397) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]

       

      Can anyone help me facing this issue?

       

       

      How per-request stategy deffers by per-process one?

       

       

       

      Thanks

       

      Laura