KIE Spring Boot sample not using database connection pool

549 views
Skip to first unread message

JB

unread,
Jul 22, 2018, 11:35:15 AM7/22/18
to jBPM Development

Hi all,


I am following KIE Spring Boot sample application: 


https://github.com/kiegroup/droolsjbpm-integration/tree/7.8.0.Final/kie-spring-boot/kie-spring-boot-samples/kie-server-spring-boot-sample


All I have changed is the Spring application.properties to use MySQL (full property file pasted below).


I am running MySQL database locally: https://hub.docker.com/_/mysql/


$ docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -d -p 3306:3306 mysql:5.7


My test process is very simple, Start -> AsyncWorkItemHandler -> End. However, every time I start a new process instance via REST API... 4 database connections are opened on MySQL and those connections are not being closed.


While performance testing several connections become opened over time, so I eventually hit MySQL connection limit and get the following error:


com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"


It appears that a database connection pool is not being used. Am I missing some configuration here? Maybe some configuration for Narayana? Any help appreciated!


Thanks.



Here is application.properties I am using:


#

# https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties

#

#server configuration

server.address=localhost

server.port=8090



#jbpm configuration

jbpm.executor.enabled=true

#jbpm.executor.retries=5

#jbpm.executor.interval=0

#jbpm.executor.threadPoolSize=1

#jbpm.executor.timeUnit=SECONDS


kieserver.restContextPath=/rest

kieserver.location=http://${server.address}:${server.port}${kieserver.restContextPath}/server

#kieserver.controllers=


kieserver.drools.enabled=true

kieserver.dmn.enabled=true

kieserver.jbpm.enabled=true

kieserver.jbpmui.enabled=true

kieserver.casemgmt.enabled=true

kieserver.optaplanner.enabled=true


# only required for jBPM

#data source configuration

spring.datasource.username=root

spring.datasource.password=password

spring.datasource.url=jdbc:mysql://localhost/jbpm

spring.datasource.driver-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

spring.datasource.type=org.apache.tomcat.jdbc.pool.XADataSource


#hibernate configuration

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect

spring.jpa.properties.hibernate.show_sql=false

spring.jpa.properties.hibernate.hbm2ddl.auto=update

spring.jpa.properties.hibernate.id.new_generator_mappings: false

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl


#transaction manager configuration

spring.jta.narayana.transaction-manager-id=1

Maciej Swiderski

unread,
Jul 23, 2018, 2:45:18 AM7/23/18
to JB, jBPM Development
hi,

I am not aware of any issues with connection pool neither in SpringBoot or traditional deployments but will take a look at it this week. 

Maciej

-- 
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-development/793211df-05ab-4bc1-9486-439acd159d57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maciej Swiderski

unread,
Jul 27, 2018, 7:05:09 AM7/27/18
to JB, jBPM Development
Alright, finally had some time to look into it and was able to reproduce it. Though it seems to be related to narayana (transaction manager and conenction handling) and apparently the version that kie server spring boot starters come with do have some issues. 
Upgrading to latest version resolved the problem so you can just update your narayana version in pom.xml to be
<narayana.version>5.9.0.Final</narayana.version>

and that should make the problem go away.

Maciej

On 22 Jul 2018, at 17:35, JB <josh...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages