Search code examples
hibernatespring-bootjpathreadpoolhikaricp

org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction


Below is my hikariCP configuration :

spring.datasource.hikari.connection-timeout=10000

spring.datasource.hikari.maximum-pool-size=10

spring.datasource.hikari.minimum-idle=15

spring.datasource.hikari.pool-name=HikariConnectionPool

While testing with JMeter, when I hit 500 threads I got following exception for some of the transactions.

org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

Solution

  • Thanks ,I have change connection-timeout From 10 sec to 100 sec It Solved my issue.