Transaction is already completed - do not call commit or rollback more than once per transaction when using narayana transaction manager with kie-server-spring-boot-starter and SQL server 2017. It works for for other databases like mysql and postgres sql
shuchitaprasad Jan 21, 2020 2:53 AMProperties are
spring.datasource.username=sa
spring.datasource.password=reallyStrongPwd123
spring.datasource.url=jdbc:sqlserver://localhost;databaseName=jbpm
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#hibernate configuration
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.hbm2ddl.auto=none
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
#transaction manager configuration
spring.jta.narayana.transaction-manager-id=1
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
versions are kie-server-spring-boot-starter - 7.26.0.Final
narayana -- 5.9.0.Final
Logs
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processFIDataFile': Unsatisfied dependency expressed through field 'runtimeDataService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runtimeDataService' defined in class path resource [org/jbpm/springboot/autoconfigure/JBPMAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jbpm.services.api.RuntimeDataService]: Factory method 'runtimeDataService' threw exception; nested exception is java.lang.RuntimeException: Could not commit session or rollback
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) ~[spring-context-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
at com.mastercard.labs.Application.main(Application.java:16) [classes!/:1.0-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [jack-henry-service-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [jack-henry-service-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [jack-henry-service-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [jack-henry-service-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'runtimeDataService' defined in class path resource [org/jbpm/springboot/autoconfigure/JBPMAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jbpm.services.api.RuntimeDataService]: Factory method 'runtimeDataService' threw exception; nested exception is java.lang.RuntimeException: Could not commit session or rollback
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
... 27 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jbpm.services.api.RuntimeDataService]: Factory method 'runtimeDataService' threw exception; nested exception is java.lang.RuntimeException: Could not commit session or rollback
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
... 40 common frames omitted
Caused by: java.lang.RuntimeException: Could not commit session or rollback
at org.jbpm.services.task.persistence.TaskTransactionInterceptor.rollbackTransaction(TaskTransactionInterceptor.java:123) ~[jbpm-human-task-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.persistence.TaskTransactionInterceptor.execute(TaskTransactionInterceptor.java:108) ~[jbpm-human-task-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.persistence.TaskTransactionInterceptor.execute(TaskTransactionInterceptor.java:49) ~[jbpm-human-task-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39) ~[drools-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73) ~[drools-persistence-api-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:45) ~[drools-persistence-api-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39) ~[drools-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.internalExecute(OptimisticLockRetryInterceptor.java:102) ~[drools-persistence-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:83) ~[drools-persistence-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:44) ~[drools-persistence-jpa-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39) ~[drools-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.internalExecute(ExecutionErrorHandlerInterceptor.java:66) ~[jbpm-runtime-manager-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:52) ~[jbpm-runtime-manager-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:29) ~[jbpm-runtime-manager-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:37) ~[drools-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:41) ~[drools-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.commands.TaskCommandExecutorImpl.execute(TaskCommandExecutorImpl.java:49) ~[jbpm-human-task-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.impl.TaskDeadlinesServiceImpl.initialize(TaskDeadlinesServiceImpl.java:457) ~[jbpm-human-task-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.HumanTaskConfigurator.getTaskService(HumanTaskConfigurator.java:166) ~[jbpm-human-task-core-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.springboot.autoconfigure.JBPMAutoConfiguration.runtimeDataService(JBPMAutoConfiguration.java:351) ~[jbpm-spring-boot-autoconfiguration-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.springboot.autoconfigure.JBPMAutoConfiguration$$EnhancerBySpringCGLIB$$d33a89b5.CGLIB$runtimeDataService$20(<generated>) ~[jbpm-spring-boot-autoconfiguration-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.springboot.autoconfigure.JBPMAutoConfiguration$$EnhancerBySpringCGLIB$$d33a89b5$$FastClassBySpringCGLIB$$1a9018ef.invoke(<generated>) ~[jbpm-spring-boot-autoconfiguration-7.26.0.Final.jar!/:7.26.0.Final]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.jbpm.springboot.autoconfigure.JBPMAutoConfiguration$$EnhancerBySpringCGLIB$$d33a89b5.runtimeDataService(<generated>) ~[jbpm-spring-boot-autoconfiguration-7.26.0.Final.jar!/:7.26.0.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
... 41 common frames omitted
Caused by: java.lang.RuntimeException: Unable to rollback transaction
at org.kie.spring.persistence.KieSpringTransactionManager.rollback(KieSpringTransactionManager.java:96) ~[kie-spring-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.services.task.persistence.TaskTransactionInterceptor.rollbackTransaction(TaskTransactionInterceptor.java:120) ~[jbpm-human-task-jpa-7.26.0.Final.jar!/:7.26.0.Final]
... 70 common frames omitted
Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:807) ~[spring-tx-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
at org.kie.spring.persistence.KieSpringTransactionManager.rollback(KieSpringTransactionManager.java:87) ~[kie-spring-7.26.0.Final.jar!/:7.26.0.Final]
... 71 common frames omitted