Home > Mobile >  How to restart spring boot application when Hikari give connection timeout?
How to restart spring boot application when Hikari give connection timeout?

Time:03-14

We have spring boot application & getting below exception. Solution for that is only spring boot application restart.

Question 1 : How I come to know that I am getting below exception and now need application restart?

Question 2 : How to restart the spring boot application ?

Exception:

Failed to obtain JDBC connection ; nested exception is a java.sql.SQLTransientConnectionException:HikariPool-1

CodePudding user response:

You can use this in your application.properties:

spring.datasource.hikari.connection-timeout=600000
spring.datasource.hikari.maximum-pool-size=500
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.minimum-idle=20
spring.datasource.hikari.validation-timeout=3000
spring.datasource.hikari.idle-timeout=60000

and if you only want to restart kill the tomcat server you can use this command:

sudo kill -9 `sudo lsof -t -i:8080`

CodePudding user response:

Bellow configuration worked for me so don't need to restart also . Thanks everyone for your help.

spring.datasource.hikari.connection-timeout = 600000

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

spring.datasource.hikari.max-lifetime=1800000

  • Related