Microprofile Health in Wildfly 22

658 views
Skip to first unread message

Gunnar Hilling

unread,
Feb 5, 2021, 2:59:38 PM2/5/21
to WildFly
I'm porting an existing JEE-Application (ear=ejb+war) to wildfly-22. I'd like to use Microprofile Health. I'm already using Microprofile Config. 
I also added the microprofile-health-smallrye extension and subsystem.
Should I expect the results of custom healthchecks (implemented with health-2.2-api, as provided by wildfly) to appear in "localhost:9990/health"?

Right now I can only "see" the standard checks.
The following code also won't be called when accessing the health-resource:

@Liveness
@ApplicationScoped
public class BaseCheck implements HealthCheck {

@Override
public HealthCheckResponse call() {
return HealthCheckResponse.down("running state");
}
}

cha...@redhat.com

unread,
Feb 6, 2021, 10:10:31 PM2/6/21
to WildFly

Yes, it's expected there, the BaseCheck looks correct to me.

Since you added microprofile-health-smallrye extension and subsystem by yourself, I'd suggest you compare it with standalone-microprofile.xml (wildfly-22.0.0.Final/standalone/configuration/standalone-microprofile.xml).

There is a MicroProfile Health QuickStart at https://github.com/wildfly/quickstart/tree/master/microprofile-health, you can also take a look examples there. Hope this helps.

Message has been deleted

Seckin Pulatkan

unread,
Aug 3, 2021, 10:28:25 AM8/3/21
to WildFly
I noticed that inside EAR it is not supported yet : https://issues.redhat.com/browse/WFLY-12835
This e-mail message is intended exclusively for the addressee or addressees and may contain personal and/or confidential information. If you have received this message in error, please notify the sender and delete this message from your system immediately. We also request that you neither use the contents nor disclose them in any manner to third parties, because the message may contain information which is protected by professional secrecy.

Seckin Pulatkan

unread,
Aug 3, 2021, 10:28:25 AM8/3/21
to WildFly
Hi Gunnar, were you able to make it work in ear?

I have tried https://github.com/wildfly/quickstart/tree/23.0.2.Final/microprofile-health WAR project on a Wildfly 23.0.2 Final server with provided standalone-microprofile.xml and it works fine when we deploy that web project.

But if I put same project into an EAR and deploy as EAR, then health endpoints only give the default checks. So it seems maybe we need to configure more to make it work inside EAR.

Latest maven ear pom file that I have used (with no success) :

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>microprofile-health-ear</artifactId>
    <packaging>ear</packaging>

    <parent>
        <groupId>org.wildfly.quickstarts</groupId>
        <artifactId>quickstart-parent</artifactId>
        <version>23.0.2.Final</version>
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <outputFileNameMapping>@{artifactId}@-@{version}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
                    <modules>
                        <webModule>
                            <groupId>org.wildfly.quickstarts</groupId>
                            <artifactId>microprofile-health</artifactId>
                        </webModule>
                    </modules>
                    <applicationName>${project.artifactId}</applicationName>
                    <archive>
                        <manifestEntries>
                            <Dependencies>javax.enterprise.api,org.eclipse.microprofile.health.api</Dependencies>
                        </manifestEntries>
                    </archive>
                    <defaultLibBundleDir>lib/</defaultLibBundleDir>
                    <skinnyWars>true</skinnyWars>
                    <version>8</version>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.quickstarts</groupId>
            <artifactId>microprofile-health</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>
    </dependencies>

</project>

On Sunday, February 7, 2021 at 6:10:31 AM UTC+3 cha...@redhat.com wrote:
Reply all
Reply to author
Forward
0 new messages