[
https://issues.jboss.org/browse/WFLY-12811?page=com.atlassian.jira.plugin...
]
Ivan Straka edited comment on WFLY-12811 at 11/22/19 6:28 AM:
--------------------------------------------------------------
Hi [~jmesnil],
yes, i have an issue if boolean is used. It does not produce NPE, nor any other error.
However it is always set to false (even if the value in the config source is true).
I have attached a reproducer. To get the property (not via Health checks) access
localhost:8080/mp-1.0/dummy
was (Author: istraka):
Hi [~jmesnil],
yes, i have an issue if boolean is used. It does not produce NPE, nor any other error.
However it is always set to false (even if the value in the config source is true).
I have attached a reproducer.
Can not inject MP Config property to a HealthCheck bean
-------------------------------------------------------
Key: WFLY-12811
URL:
https://issues.jboss.org/browse/WFLY-12811
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, MP Health
Affects Versions: 18.0.1.Final
Reporter: Ivan Straka
Assignee: Jeff Mesnil
Priority: Critical
Attachments: mp-1.0.war
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.
{code:java}
@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();
}
}
{code}
I am get following error:
{code:java}
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)
{code}
I believe there is a bug in MP Health integration rather than in weld. After checks are
registered here in
[
CDIExtension|https://github.com/wildfly/wildfly/blob/master/microprofile/...]
I am able to call _check.call()_ and I get _UP_ as a result. However during HTTP call here
in
[
HealthReporter|https://github.com/wildfly/wildfly/blob/master/microprofil...]
I get NPE.
I can inject a dummy bean. However if the dummy bean injects a config property, NPE is
thrown.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)