Spring Boot application stuck at: Initializing Spring DispatcherServlet 'dispatcherServlet'
Asked Answered
M

3

7

I am upgrading a Spring Boot application from version 1.5.6 to 2.1.1. When I start the application, it gets stuck at this line:

INFO: Initializing Spring DispatcherServlet 'dispatcherServlet'

When I hit this URL: http://localhost:8888/actuator/health, I get {"status":"UP"}

Also when I hit this URL: http://localhost:8888/swagger-ui.html, I see the Swagger UI.

But my main application doesn’t start. Any idea why it’s stuck?

Mandie answered 11/12, 2018 at 19:14 Comment(7)
You should be able to see from your spring loggers where it’s stuckBicipital
Why do you think it's stuck? Put another way, what are you expecting to happen that has not happened?Mitchel
There's no message after that. Shouldn't I see a message saying 'Server started'?Mandie
@Bicipital - You mean enable DEBUG? Hmm.... how do I do that?Mandie
Refer docs.spring.io/spring-boot/docs/current/reference/html/…Bicipital
Interestingly, it IS starting but it's not recognizing 'server.context-path' value which is set to: /api/v2.0. Also, I don't see the 'standard' message saying that it's up & running. Thoughts?Mandie
server.context-path is changed to 'server.servlet.context-path'Mandie
M
1

You have just to exclude security auto configuration.

Just add on your main SpringbootApplication

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
Mark answered 16/1, 2021 at 17:48 Comment(0)
N
1

I was facing the same issue. Below code was already a part of my application's main class.

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)

I could not see any logs saying that application has started or anything as such. I had logging level to DEBUG.

 logging:
  level:
    root: ERROR
    org:
      springframework: DEBUG

But when I tried hitting my APIs from localhost, it could get expected response. The application was running on port 8080 in my case.

Nicety answered 19/1, 2022 at 8:10 Comment(1)
Just edited the answer. Logging level was set to DEBUG although I had mentioned here as ERROR. Corrected that.Nicety
G
0

I know its old.

I was stuck similarly when I tried to move from SpringBoot 1.5 to 2. What fixed it for me was when I added @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) based on differences in springboot2 and this springboo2 security tutorial . Spring 2 migration guide -> 2

Graveyard answered 16/10, 2019 at 6:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.