0

I get Could not load Logmanager "org.jboss.logmanager.LogManager" on docker run.. What is the ideal approach to load those logger jars for java 17? This was working fine in java 8. However, using Xbootclasspath/a is not working in java 17. Any better approach to have all these jmx, jboss compatabile with java 17

DockerFile

Below is the docker file which has version of wildfly.

ENV JAVA_HOME=/usr/lib/jvm/java
ENV WILDFLY_VERSION=28.0.1.Final
ENV WILDFLY_SHA1=8702fb7ba8d1249bf058e2223f662e5176b39d0d
ENV JBOSS_HOME=/opt/jboss/wildfly
ENV JMX_EXPORTER_VERSION=0.16.1


RUN cd $HOME && \
    curl -OL https://github.com/wildfly/wildfly/releases/download/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz && \
    echo "$WILDFLY_SHA1 wildfly-$WILDFLY_VERSION.tar.gz" | sha1sum -c - && \
    tar xf wildfly-$WILDFLY_VERSION.tar.gz && \
    mv wildfly-$WILDFLY_VERSION $JBOSS_HOME && \
    rm wildfly-$WILDFLY_VERSION.tar.gz



USER root
RUN curl -L -o jmx_prometheus_javaagent-$JMX_EXPORTER_VERSION.jar https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/$JMX_EXPORTER_VERSION/jmx_prometheus_javaagent-$JMX_EXPORTER_VERSION.jar && \
    echo "jmx_prometheus_javaagent-$JMX_EXPORTER_VERSION.jar" && \
    mkdir -p /opt/jmx_exporter/ && \
    mv jmx_prometheus_javaagent-$JMX_EXPORTER_VERSION.jar /opt/jmx_exporter/jmx_exporter.jar && \
    chown jboss:jboss /opt/jmx_exporter/
ADD jmx_config.yaml /opt/jmx_exporter/jmx_config.yaml

# Adjust WildFly configuration
RUN sed -i -E "s:.*PRESERVE_JAVA_OPTS.*:. /etc/jboss-as/jboss-as.conf:" /opt/jboss/wildfly/bin/standalone.conf

jboss-config

-Xbootclasspath/a:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.1.4.GA.jar:/opt/jboss/wildfly/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final.jar \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.rmi.port=1234 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager \
-Djava.util.logging.ConsoleHandler.level=ALL \
-Djava.rmi.server.hostname=hdap-api \
-javaagent:/opt/jmx_exporter/jmx_exporter.jar=1090:/opt/jmx_exporter/jmx_config.yaml \
"

Error

java.lang.ClassNotFoundException: org.jboss.logmanager.LogManager
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    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(AccessController.java:318)
    at java.logging/java.util.logging.LogManager.<clinit>(LogManager.java:222)
    at java.logging/java.util.logging.Logger.demandLogger(Logger.java:649)
    at java.logging/java.util.logging.Logger.getLogger(Logger.java:718)
    at java.logging/java.util.logging.Logger.getLogger(Logger.java:702)
    at io.prometheus.jmx.shaded.io.prometheus.jmx.JmxCollector.<clinit>(JmxCollector.java:39)
    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:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
WARNING: Failed to load the specified log manager class org.jboss.logmanager.LogManager
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logmanager/Level
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at org.jboss.modules.Module.run(Module.java:341)
    at org.jboss.modules.Module.run(Module.java:321)
    at org.jboss.modules.Main.main(Main.java:604)
3
  • 1
    The first thing I see is the log manager version looks wrong to me. The version in WildFly 28 is 2.1.19.Final. The logging version looks wrong too. That said, have you tried adding the agent to MODULE_OPTS instead of JAVA_OPTS? Commented Aug 18 at 14:25
  • thanks a lot .. moving to module_opts works. but only when i skip those jmxremote JAVA args AND -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager \ Else it complains about IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager" Commented Aug 19 at 14:30
  • Yes. You don't really want to configure JMX that way. I'd need to better understand the goal in order to understand what needs to be configured. By default it listens on port 9990. Commented Aug 19 at 19:54

1 Answer 1

0

Your issue is not due to running in a container but because you are using a java agent. You should use MODULE_OPTS env variable to deine your agent so that the LogManager is properly configured when your agent starts.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.