title: Cannot run JMX Exporter in Wildfly 17 running on Java 11
body: <p>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 Prometheus we installed <code>jmx_exporter</code> and configured it as shown below.</p>
  
  <p>Now we'd like to switch to the official Docker image <code>jboss/wildfly:17.0.1.Final</code> which however uses Java 11. When using our current configuration the JVM cannot be created because <code>-Xbootclasspath/p</code> is not supported anymore. Only <code>-Xbootclasspath/a</code> or <code>-Xbootclasspath</code> are valid.</p>
  
  <p>Just replacing <code>-Xbootclasspath/p</code> with <code>-Xbootclasspath/a</code> does not work and gives the following error message upon startup:</p>
  
  <pre><code>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.&lt;clinit&gt;(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.&lt;clinit&gt;(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
  </code></pre>
  
  <h3>Configuration for Java 8</h3>
  
  <p>(excerpt from our <code>Dockerfile</code>)</p>
  
  <pre><code># 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"
  </code></pre>