BindersHealthContributor throws NPE when access by actuate endpoint(health)
See original GitHub issueWhen a reactive(webflux) project including following pom, and no define any “Input” or “Output” channel, then get health info in browser “GET http://hostname:port/actuate/health”, ReactiveWebOperationAdapter throws exception, just disable binder actuate is OK.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
disable it is OK.
management:
health:
binders:
enabled: false
java.lang.NullPointerException: null
at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:128)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Assembly trace from producer [reactor.core.publisher.MonoLiftFuseable] :
reactor.core.publisher.Mono.flatMap(Mono.java:2713)
org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReactiveWebOperationAdapter.handle(AbstractWebFluxEndpointHandlerMapping.java:323)
Error has been observed at the following site(s):
|_ Mono.flatMap ? at org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReactiveWebOperationAdapter.handle(AbstractWebFluxEndpointHandlerMapping.java:323)
|_ Mono.flatMap ? at org.springframework.web.reactive.result.method.annotation.ResponseEntityResultHandler.handleResult(ResponseEntityResultHandler.java:130)
|_ checkpoint ? Handler org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler#handle(ServerWebExchange) [DispatcherHandler]
|_ Mono.error ? at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handleException(RequestMappingHandlerAdapter.java:238)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Spring Boot Actuator - LDAP Health Endpoint Throwing NPE
This is a spring-ldap bug that has a fix committed, but it doesn't appear to be merged into the main spring-ldap branch yet....
Read more >JobExecutorHealthIndicator - Health check failed.java.lang ...
JobExecutorHealthIndicator - Health check failed.java.lang.NullPointerException: null ... I was getting below error in camunda-spring-boot server ...
Read more >Java NullPointerException - Detect, Fix, and Best Practices
Throwing null in the program; Accessing index or modifying value of an index of an array that is null; Checking the length of...
Read more >How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >NullPointerException (Java Platform SE 7 ) - Oracle Help Center
public class NullPointerException extends RuntimeException. Thrown when an application attempts to use null in a case where an object is required.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@matthewhaywardmsm We were able to look further with @artembilan on the issue. Here is the problem. In your build dependency, you have this:
When you have this dependency, the test context will use this binder as the default binder. This binder does not provide any health indicators at all. This is the reason for the test failure. Since you are trying to use it with Kafka binder, I suggest that you remove this dependency and then rely on the production binder only -
implementation 'org.springframework.cloud:spring-cloud-stream-binder-kafka'
. When we tried it locally, the test passes. If you really want to use the test binder for any testing, you might want to isolate that into a separate module.Hope this helps.
@matthewhaywardmsm @fanticat Closing this issue. Please re-open if you are still facing an issue with this.