question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BindersHealthContributor throws NPE when access by actuate endpoint(health)

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sobychackocommented, Nov 7, 2019

@matthewhaywardmsm We were able to look further with @artembilan on the issue. Here is the problem. In your build dependency, you have this:

testImplementation 'org.springframework.cloud:spring-cloud-stream-test-support'

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.

0reactions
sobychackocommented, Nov 12, 2019

@matthewhaywardmsm @fanticat Closing this issue. Please re-open if you are still facing an issue with this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found