javajbosswildflymetricswildfly-26

Problem with Microprofile Metrics on Wildfly 26


i'm currently upgrading from Wildfly 20 to Wildfly 26. The standalone.xml doesn't start, because of an Injection of MetricRegistry and the newly missing microprofile.metrics-smallrye-extension (already described under: MicroProfile Metrics do not show custom metrics on Wildfly 25). But if i start the standalone-microprofile.xml or add the extensions (see CLI-commands below), i ran into the same error.

Maybe the Keycloak-Integration-Workaround is conflicting. The Wildfly-internal OIDC adapter is actualy not working in bearer-only-mode. So i installed the current keycloak-client (keycloak-oidc-wildfly-adapter-16.1.1) an the workaround (see as last code-template).

2022-02-21 12:44:09,176 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."xyz.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."xyz.war".WeldStartService: Failed to start service
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jboss.weld.exceptions.DeploymentException: SRMET00013: Description is different from the description in previous usage
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:38)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:510)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
        at org.jboss.as.weld@26.0.1.Final//org.jboss.as.weld.WeldStartService.start(WeldStartService.java:98)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
        at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
        ... 6 more
Caused by: java.lang.IllegalStateException: SRMET00013: Description is different from the description in previous usage
        at io.smallrye.metrics//io.smallrye.metrics.MetricsRegistryImpl.verifyMetadataEquality(MetricsRegistryImpl.java:188)
        at io.smallrye.metrics//io.smallrye.metrics.MetricsRegistryImpl.get(MetricsRegistryImpl.java:459)
        at io.smallrye.metrics//io.smallrye.metrics.MetricsRegistryImpl.get(MetricsRegistryImpl.java:402)
        at io.smallrye.metrics//io.smallrye.metrics.MetricsRegistryImpl.timer(MetricsRegistryImpl.java:371)
        at io.smallrye.metrics//io.smallrye.metrics.setup.MetricsMetadata.registerMetrics(MetricsMetadata.java:111)
        at io.smallrye.metrics//io.smallrye.metrics.setup.MetricCdiInjectionExtension.registerMetrics(MetricCdiInjectionExtension.java:186)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:187)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
        at javax.enterprise.api//javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.util.Observers.notify(Observers.java:166)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
        at org.jboss.weld.core@3.1.8.Final//org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)

CLI-Commands to extend the standalone.xml

wildfly/bin/jboss-cli.sh -c "/extension=org.wildfly.extension.microprofile.metrics-smallrye:add()"
wildfly/bin/jboss-cli.sh -c "/subsystem=microprofile-metrics-smallrye:add()"

wildfly/bin/jboss-cli.sh -c "/extension=org.wildfly.extension.microprofile.fault-tolerance-smallrye:add()"
wildfly/bin/jboss-cli.sh -c "/subsystem=microprofile-fault-tolerance-smallrye:add()"

OIDC-Workaround (installation of keycloak client)

embed-server --server-config=${server.config:standalone.xml}

batch
/subsystem=undertow/application-security-domain=other:undefine-attribute(name=security-domain)
/subsystem=undertow/application-security-domain=other:write-attribute(name=http-authentication-factory,value=keycloak-http-authentication)
run-batch

/subsystem=ejb3/application-security-domain=other:write-attribute(name=security-domain,value=KeycloakDomain)

reload


Solution

  • Oh i spend a couple of hours to get rid of this problem.. but only minutes after writing this post, i found the "bad guy". The Microprofile Version 3.3 (on Wildfly 20) ignored annotations (like @Timed) at interface-methods. The new Version 4.1 (Wildfly 26) regards them..

    pretty easy, afterwards :)


    marginal note: If you have more than one WAR deployed on your Wildfly and one of them is using the public API of an other one, then you'll run into problems with hot-deployments. I assume, in my case it occurs because i have placed the Timed-annotation at the implementation-class and not at the interface, that is used as ResteasyClient-proxy. Every time i deploy the depending WAR after the rest-api-defining WAR, i got an exception: no metric mapped. A redeployment of the rest-api-defining WAR fixes this issue :)