Spring Boot Actuator not working- Whitelabel Error Page
Asked Answered
P

5

6

Spring Boot Actuator is not working for rest-full application, getting Whitelabel Error Page on browser and below error in console log.

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /actuator/health

Added below maven dependency.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

I cross checked, jar file available in class path.enter image description here

Spring boot application version

<version>2.4.1</version>

Added properties in application.properties file

management.endpoints.enabled-by-default=true
management.endpoint.info.enabled=true
management.security.enabled=false
management.endpoints.web.exposure.include=*
spring.mvc.throw-exception-if-no-handler-found=true

Unable to access Actuator with below URL's

http://localhost:8090/actuator/health
http://localhost:8090/actuator/
http://localhost:8090/health/

Logs

WARN IN-WKS-435 [nio-8090-exec-1] o.s.w.s.PageNotFound                     : No mapping for GET /actuator/health
WARN IN-WKS-435 [nio-8090-exec-1] o.s.w.s.PageNotFound                     : No handler found for GET /actuator/health
WARN IN-WKS-435 [nio-8090-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /actuator/health]

Note: Apart from this, whole application is working fine.

Kindly suggest if I need to add any additional configuration in our application.

Promotion answered 20/2, 2021 at 7:30 Comment(4)
Please check next few points: 1. if there is management.server.port configuration value in properties? It will change the port where actuator is accessible 2. Logs of application upon call - to see if there are no errors 3. On startup of application please check log line Exposing 14 endpoint(s) beneath base path '/actuator' - to double-check that such endpoints are actually exposed. Hope this helps to identify the root causeOrganize
@Organize Thanks for your prompt response, on startup I could not see Exposing 14 endpoint(s) beneath base path '/actuator'. I just edited the post and added logs as well.Promotion
Can you see the actuator in external libraries? Maybe somehow it isn't added correctly @VivekJainAetna
dextertron I verified , it's available in class path.Promotion
C
3

Spring Boot Actuators endpoints could not be picked-up if running within IDE(IntelliJ or Eclipse).

I tried to run jar using below command(outside of IDE) on cmd and it worked for me.

c:\workspace\demo\target\java -jar demo-spring-boot-project.jar

And I was able to access below URL

http://localhost:8090/actuator/health

Caritacaritas answered 18/4, 2021 at 19:37 Comment(0)
H
4

Encountered this too while running the app through InteliJ IDEA. It turns out I added the spring-boot-starter-actuator dependency but did not tell Maven to reload the project.

Right clicking on the pom.xml file and selecting Maven->Reload project, solved it.

*In this case I see the jar file exists in your classpath, so your problem is different than mine. Leaving this comment so it might help someone else.

Hollo answered 12/9, 2021 at 13:50 Comment(0)
C
3

Spring Boot Actuators endpoints could not be picked-up if running within IDE(IntelliJ or Eclipse).

I tried to run jar using below command(outside of IDE) on cmd and it worked for me.

c:\workspace\demo\target\java -jar demo-spring-boot-project.jar

And I was able to access below URL

http://localhost:8090/actuator/health

Caritacaritas answered 18/4, 2021 at 19:37 Comment(0)
A
3

I have encountered the same issue while running the project through IntelliJ IDE. I resolved after doing Invalidate Cache & Restart in IntelliJ IDE.

Go to File -> ``Invalidate Cache`.

The Invalidate cache dialog box appears. One can select accordingly to their project.

Asclepius answered 18/10, 2021 at 2:2 Comment(0)
M
-1

It requires a dependency for auto configuring Actuator. Below is the dependency you need to add.

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator-autoconfigure</artifactId>
    </dependency>
Matrices answered 26/5, 2023 at 11:36 Comment(0)
S
-1

Try to update the maven Project , if you are using Eclipse IDE go to Project -> Update Maven Project Select all Check boxes Except Offline and the click ok. it will update maven Dependency. Hope it Fixed Your Problem.

Sinatra answered 21/12, 2023 at 7:24 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.