'Spring Boot app freezes on startup using Hibernate

2021-05-30 17:35:18.765  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2021-05-30 17:35:19.462  INFO 9812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2021-05-30 17:35:19.519  INFO 9812 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect

After that, it just hangs indefinitely. No more debug messages are outputted, and nothing happens. I've let it sit there for hours, but nothing. I have no idea why it's just freezing.

[log of freezing and after 30 minutes it's working (click on this link for view image) image for log

check this image after freezing it's working fine but after 30 minutes. I don't why it takes 30 or 40 minutes to launch.



Solution 1:[1]

It is hard to tell like this what could be the possible reason. You can try below things :

  • First, check DB is up and you are able to connect to DB externally?
  • If yes, Try dropping and recreating schema.
  • Take thread dumps to see what exactly thread is doing - it will give hints for the direction to check things.
  • Set hibernate's show sql property to true. You might see the sql, if any , causing the issue.
  • Set the debug in Spring Beans which initialises the DB and check where is exactly failing.

Solution 2:[2]

try disabling hibernate schemavalidation i.e. set spring.jpa.hibernate.ddl-auto=none

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tarun
Solution 2 secario