Cannot run JMX Exporter in Wildfly 17 running on Java 11
See original GitHub issueCurrently we’re running Wildfly (version 17.0.1.Final) in a self-created Docker image based on Java 8. For monitoring our application via Prometheus we installed jmx_exporter and configured it as shown below.
Now we’d like to switch to the official Docker image jboss/wildfly:17.0.1.Final
which however uses Java 11. When using our current configuration the JVM cannot be created because -Xbootclasspath/p
is not supported anymore.
Just replacing -Xbootclasspath/p
with -Xbootclasspath/a
does not work and gives the following error message upon startup:
Could not load Logmanager "org.jboss.logmanager.LogManager"
java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.logging/java.util.logging.LogManager$1.run(LogManager.java:239)
at java.logging/java.util.logging.LogManager$1.run(LogManager.java:223)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.logging/java.util.logging.LogManager.<clinit>(LogManager.java:223)
at java.logging/java.util.logging.Logger.demandLogger(Logger.java:648)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:717)
at java.logging/java.util.logging.Logger.getLogger(Logger.java:701)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.<clinit>(JmxCollector.java:38)
at io.prometheus.jmx.shaded.io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
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 java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
Configuration
(excerpt from our Dockerfile)
# Prometheus (JMX Exporter)
# Versions must match those provided by application server.
# https://lazarbulic.com/blog/2018/05/25/prometheus-jmx_exporter-for-jboss-wildfly/
# We need to add these JARs explicitly to avoid a NoClassDefFoundError.
# https://stackoverflow.com/questions/55874743/noclassdeffounderror-when-using-jmx-exporter-with-wildfly-15
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-$WILDFLY_COMMON_VERSION.jar"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-$JBOSS_LOG_MANAGER_VERSION.jar"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-$LOG4J_JBOSS_LOGMANAGER_VERSION.jar"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/slf4j/impl/main/slf4j-jboss-logmanager-$SLF4J_JBOSS_LOGMANAGER_VERSION.jar"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JBOSS_MANAGEMENT_PORT -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=$JBOSS_MANAGEMENT_PORT -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=localhost"
ENV PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -javaagent:$JBOSS_HOME/prometheus/jmx-prometheus.jar=$PROMETHEUS_PORT:$JBOSS_HOME/prometheus/config.yaml"
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Cannot run JMX Exporter in Wildfly 17 running on Java 11
Currently we're running Wildfly (version 17.0.1.Final) in a self-created Docker image based on Java 8. For monitoring our application via ...
Read more >Java - Source-to-Image (S2I) - OpenShift Documentation
OpenShift Online provides S2I builder images for building Java applications. ... Runs the assemble script (from the builder image). Saves the final image....
Read more >ubi8/openjdk-11 - Certified Container Image
OpenJDK 11 container is a base platform for building and running plain Java 11 applications, e.g. fat-jar and flat classpath. The container image...
Read more >WildFly Admin Guide
With WildFly, in order to run using IPv4 addresses, you need to specify java.net.preferIPv4Stack=true; in order to run with IPv6 addresses, ...
Read more >Oracle JDK Migration Guide - Java
In JDK 11, the Java EE and CORBA modules were removed. ... oldApp that runs on the classpath must use the unexported com.sun.jmx.remote.internal...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ndimitry yes, I use it and it works.
To run with the Java 11 put this in the standalone.conf: