Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot App Freezes on Startup

I have a Spring Boot App using an Oracle Data source that is freezing on startup. The last messages outputted on the console are:

[2017-12-18T15:34:19,425] INFO  org.hibernate.dialect.Dialect HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect 
[2017-12-18T15:34:27,186] INFO  org.hibernate.hql.internal.QueryTranslatorFactoryInitiator HHH000397: Using ASTQueryTranslatorFactory 

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.

The weird thing is that everything was working fine. No changes were made. All of a sudden this started happening, and I have no idea why it's just freezing.

like image 236
cloudwalker Avatar asked Dec 18 '17 20:12

cloudwalker


People also ask

How do I fix spring boot application failed to start?

First change the start-class to your application class. Second add the super-cool Spring Boot maven builder to your pom. Then use "mvn install" to create your jar. Your code runs just fine.

Why does my spring boot app keep closing?

We know that a Spring Boot web app needs an embedded servlet container on the classpath. The app will shut down if it doesn't find any of the embedded servlet containers. To resolve the unexpected shut down during startup, we need to obtain a fully configured instance using the appropriate Starter.


1 Answers

It's hard to tell what happens out of the information you've provided, I can just propose a couple of things that can shed some light on whats going on:

  1. Try to take thread dump and see what exactly does each thread do. If you will take some thread dumps and will see that thread that looks relevant is stuck somewhere you'll probably be able to better understand the reason from the stacktrace.

  2. Enable logs for DEBUG, you say that no debug messages appear, but in the snippet, you've shown only a couple of INFO messages. You can probably start with setting spring and hibernate logs for DEBUG.

  3. Try to connect to the empty database - maybe it tries to read something during the initialization (stuff like metadata) and it takes too long (although I don't believe it should take hours), but still...

  4. You can try to see which SQLs are being executed during the startup. Just set hibernate's "show sql" property to true and maybe it will help

  5. You can also place a breakpoint in spring to see which bean gets stuck and try to understand out of its code whats going on (I know its a little bit vague, but the point is to find which bean fails to start and just debug it).

like image 112
Mark Bramnik Avatar answered Sep 29 '22 22:09

Mark Bramnik