Caused by: org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction+kie-server-spring-boot-starter+ms sql+jbpm
shuchitaprasad Jan 24, 2020 4:50 AMI am trying to use kie-server-spring-boot-starter for setting jbpm with MS Sql server as database. When I create a plain spring boot application with MS Sql as database, the server start up is clean. The moment I add kie-server-spring-boot-starter as dependency, I get the above mentioned exception. Please find pom.xml and properties file.
<properties>
<java.version>1.8</java.version>
<version.org.kie>7.26.0.Final</version.org.kie>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-server-spring-boot-starter</artifactId>
<version>${version.org.kie}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>runtime</scope>
</dependency>
properties file
server.address=0.0.0.0
server.port=8080
cxf.path=/rest
#kie server config
kieserver.serverId=jack-henry-service
kieserver.serverName=jack-henry-service
kieserver.location=http://localhost:8080/rest/server
#kie server capabilities
kieserver.drools.enabled=false
kieserver.dmn.enabled=true
kieserver.jbpm.enabled=true
kieserver.jbpmui.enabled=true
kieserver.casemgmt.enabled=true
#kieserver.prometheus.enabled=true
#jbpm configuration
jbpm.executor.enabled=false
#data source configuration
spring.datasource.username=sa
spring.datasource.password=reallyStrongPwd123
spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=jbpmtest
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
#hibernate configuration
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
And exception stack trace is
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$$d1a39800.CGLIB$runtimeDataService$3(<generated>) ~[jbpm-spring-boot-autoconfiguration-7.26.0.Final.jar!/:7.26.0.Final]
at org.jbpm.springboot.autoconfigure.JBPMAutoConfiguration$$EnhancerBySpringCGLIB$$d1a39800$$FastClassBySpringCGLIB$$fcbac05c.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$$d1a39800.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