Jhipster version 7.8.1 Springboot version 2.6.6 PostgreSQL 14.9 OS : Ubuntu
I generated a spring boot project and connected it to PostgreSQL successfully very first time.
The second time the application startup threw the below error.
2023-11-28 22:48:56.595 ERROR 18292 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=com.app.domain.Student]
2023-11-28 22:48:56.606 WARN 18292 --- [ daseapp-task-1] com.zaxxer.hikari.pool.ProxyConnection : Hikari - Connection org.postgresql.jdbc.PgConnection@707a307 marked as broken because of SQLSTATE(08003), ErrorCode(0)
org.postgresql.util.PSQLException: This connection has been closed.
at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:883)
at org.postgresql.jdbc.PgConnection.getMetaData(PgConnection.java:1315)
I tried to stop the application through Ctl+C and also tried the actuator/shutdown. Always the Hikari error shows for subsequent bootup.
When I recreated the Database and restarted the db server, the spring boot application was able to connect for the first time successfully. Again second time the same Hikari error.
Below is the spring yaml configuration
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://localhost:5432/XXXX
username: XXXX
password: XXXX
hikari:
poolName: Hikari
auto-commit: false
connectionTestQuery: SELECT 1
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
idleTimeout : 600000
validationTimeout : 300000
connectionTimeout: 30000
maxLifetime : 1800000
removeAbandoned : true
removeAbandonedTimeout : 60