0 Replies Latest reply on Nov 19, 2012 6:06 AM by Jean-François Houzard

    Jbpm with user transaction

    Jean-François Houzard Newbie

      Hi!

       

      I have a very basic workflow. In my workflow I have a diverging gateway.

      In this gateway I use a service to control the flow.

       

      My problem is that my service is a transactional service (I use spring-data in it), and as soon as I use this service to decide, I get an exception like the following.

       

      How can I use a transactional service in the gateway?

       

      Thank you

       

      org.jbpm.workflow.instance.WorkflowRuntimeException: [eu.publications.ceres.jbpm.module_workflow:21 - check_bypass:14] -- Exception when trying to evaluate constraint execute in split check_bypass

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

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

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

                at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)

                at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)

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

                at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)

                at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:188)

                at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:303)

                at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:168)

                at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:138)

                at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1082)

                at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:320)

                at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:120)

                at org.drools.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:39)

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

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

                at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.startProcess(CommandBasedStatefulKnowledgeSession.java:223)

                at eu.publications.ceres.jbpm.ModuleWorkflowIT.runModuleWorkflowTest(ModuleWorkflowIT.java:101)

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

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

                at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)

                at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)

                at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)

                at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)

                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

                at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

                at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)

                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Caused by: java.lang.RuntimeException: Exception when trying to evaluate constraint execute in split check_bypass

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

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

                ... 47 more

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

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

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

                ... 48 more

      Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Unknown node instance type: org.jbpm.workflow.instance.node.SplitInstance@413f9276; nested exception is java.lang.IllegalArgumentException: Unknown node instance type: org.jbpm.workflow.instance.node.SplitInstance@413f9276

                at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:301)

                at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:404)

                at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)

                at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)

                at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)

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

                at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91)

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

                at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)

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

                at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

                at $Proxy36.findByEventCodeAndOrigin(Unknown Source)

                at eu.publications.ceres.jbpm.service.impl.DecisionHelperService.checkBypass(DecisionHelperService.java:39)

                at eu.publications.ceres.jbpm.ModuleWorkflowIT$1.checkBypass(ModuleWorkflowIT.java:51)

                at eu.publications.ceres.jbpm.Process_eu_publications_ceres_jbpm_module_workflow_44f51f3fbd8346aca5a1aef536c68e4f.returnValueEvaluator3(Process_eu_publications_ceres_jbpm_module_workflow_44f51f3fbd8346aca5a1aef536c68e4f.java:28)

                at eu.publications.ceres.jbpm.Process_eu_publications_ceres_jbpm_module_workflow_44f51f3fbd8346aca5a1aef536c68e4fReturnValueEvaluator3Invoker.evaluate(Process_eu_publications_ceres_jbpm_module_workflow_44f51f3fbd8346aca5a1aef536c68e4fReturnValueEvaluator3Invoker.java:15)

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

                ... 49 more

      Caused by: java.lang.IllegalArgumentException: Unknown node instance type: org.jbpm.workflow.instance.node.SplitInstance@413f9276

                at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeNodeInstanceContent(AbstractProtobufProcessInstanceMarshaller.java:343)

                at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeNodeInstance(AbstractProtobufProcessInstanceMarshaller.java:149)

                at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:107)

                at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:70)

                at org.jbpm.persistence.processinstance.ProcessInstanceInfo.update(ProcessInstanceInfo.java:198)

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

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:37)

                at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:94)

                at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:79)

                at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:61)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:349)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155)

                at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)

                at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)

                at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)

                at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1175)

                at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1251)

                at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)

                at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:269)

                at org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:123)

                at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:55)

                at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:95)

                at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:85)

                at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:313)

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

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

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

                at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)

                ... 61 more