-
Bug
-
Resolution: Done
-
Blocker
-
18.0.1.Final
-
None
I am playing a bit with MP specs (getting multiple specs to work together). I have been trying to return Health status based on injected config property (MP Config). However it looks like the property is not properly injected to the bean.
@Liveness @ApplicationScoped public class CDIBasedLivenessHealthCheck implements HealthCheck { @Inject @ConfigProperty(name = "dummy_live") private Provider<Boolean> live; @Override public HealthCheckResponse call() { return HealthCheckResponse.named("dummy") .state(live.get()) .build(); } }
I am get following error:
15:41:04,616 ERROR [org.wildfly.extension.microprofile.health.smallrye] (management I/O-2) Error processing Health Checks: java.lang.NullPointerException at health.CDIBasedLivenessHealthCheck.call(CDIBasedLivenessHealthCheck.java:26) at health.CDIBasedLivenessHealthCheck$Proxy$_$$_WeldClientProxy.call(Unknown Source) at org.wildfly.extension.microprofile.health.HealthReporter.jsonObject(HealthReporter.java:120) at org.wildfly.extension.microprofile.health.HealthReporter.fillCheck(HealthReporter.java:107) at org.wildfly.extension.microprofile.health.HealthReporter.processChecks(HealthReporter.java:96) at org.wildfly.extension.microprofile.health.HealthReporter.getHealth(HealthReporter.java:79) at org.wildfly.extension.microprofile.health.HealthReporter.getHealth(HealthReporter.java:60) at org.wildfly.extension.microprofile.health.HealthContextService$HealthCheckHandler.handleRequest(HealthContextService.java:100) at org.jboss.as.domain.http.server.security.RealmReadinessHandler.handleRequest(RealmReadinessHandler.java:51) at org.jboss.as.domain.http.server.security.ServerErrorReadinessHandler.handleRequest(ServerErrorReadinessHandler.java:35) at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:91) at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:211) at io.undertow.server.handlers.cache.CacheHandler.handleRequest(CacheHandler.java:92) at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:78) at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49) at org.jboss.as.domain.http.server.ManagementHttpRequestHandler.handleRequest(ManagementHttpRequestHandler.java:57) at org.jboss.as.domain.http.server.cors.CorsHttpHandler.handleRequest(CorsHttpHandler.java:75) at org.jboss.as.domain.http.server.ManagementHttpServer$UpgradeFixHandler.handleRequest(ManagementHttpServer.java:672) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255) at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136) at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162) at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100) at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178) at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612) at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
I believe there is a bug in MP Health integration rather than in weld. After checks are registered here in CDIExtension I am able to call check.call() and I get UP as a result. However during HTTP call here in HealthReporter I get NPE.
I can inject a dummy bean. However if the dummy bean injects a config property, NPE is thrown.
- is cloned by
-
JBEAP-18737 (7.3.z) Can not inject MP Config property to a HealthCheck bean
- Closed
- relates to
-
WFLY-12798 HealthCheck HTTP endpoint does not support CDI @RequestScoped scope
- Open