Spring Boot Application gets stuck on “Hikari-Pool-1 - Starting…”

后端 未结 5 520
滥情空心
滥情空心 2021-01-07 22:11

I\'m trying to run Spring Boot application connected to PostgreSQL database. However, when it comes to Hikari connection pool initializing, it just gets stuck and nothing go

相关标签:
5条回答
  • 2021-01-07 22:21

    try passing this parameter when you run your jar file:

    -Djava.security.egd=file:/dev/../dev/urandom

    0 讨论(0)
  • 2021-01-07 22:26

    In my case spring.datasource.hikari.initializationFailTimeout was set to a really high value, 3600000 (1 hour). This, in it self, was not a malconfiguration but it hid the real problem as the app was hanging on startup.

    Once that value was adjusted, I got a much more understandable stack trace which led me to the conclusion that in this case I couldn't use the default MariaDB driver configuration that I probably got through a jHipster.

    A very wierd problem that I so far only has seen with MySQL8 and Ubuntu 20 on AWS EC2. Locally I run Ubuntu and MySQL8 via Docker without issues.

    0 讨论(0)
  • 2021-01-07 22:34

    Making below change in application.properties should work fine:

    spring.datasource.url=jdbc:postgresql://localhost:5432/<dbName>
    

    Also make sure, you have Fixed Port Number box unchecked, in the pgAdmin configuration BOX, refer the screenshot

    0 讨论(0)
  • 2021-01-07 22:43

    Normal postgresql port is 5432, so I assume you also configured it to 55491.

    Double check this via your postgresql client using psql -h 127.0.0.1 -p 55491 -d TodoAppDatabase -U admin

    At last you can put the HikariCP into DEBUG mode, so you can see what parameters its using.

    If your properties file is really apllication.properties than this may also an issue because spring boot only picks up application.properties automatically.

    0 讨论(0)
  • 2021-01-07 22:44

    In my case it was a problem with a network connectivity. Make sure you can access your any configured servers if you got into this issue.

    telnet host 5432 will let you connect to see if a route exists to the DB server.

    0 讨论(0)
提交回复
热议问题