Marcus Adams
Marcus Adams

Reputation: 1267

Wildfly 17 enabling JMX remote on the same server gives logmanager errors

I’m looking to enable JMX to allow datadog to monitor our java JBoss wildfly systems but keep hitting runtime errors

I have set up the standalone.xml with

<subsystem xmlns="urn:jboss:domain:jmx:1.3">              
            <expose-resolved-model/>                     
            <expose-expression-model/>                           
            <remoting-connector use-management-endpoint="true"/>                       
</subsystem>

And

<interfaces>
    <interface name="management">
    <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>

As well as

<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

Then in my startup.sh i have added

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"

But this gives me

java.lang.IllegalStateException: The LogManager was not properly installed (you must set the "java.util.logging.manager" system property to "org.jboss.logmanage r.LogManager")

This seems to be fairly common if I look at both here and on google but there seem to be different solutions depending on the version of wildfly.

I think I need to do something like Set at the start of the standalone.conf

JBOSS_MODULES_SYSTEM_PKGS="org.jboss.logmanager"

And then

JBOSS_HOME="/opt/wildfly"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.11.Final.jar -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar"

At the end.

But I still get errors “Could not load Logmanager "org.jboss.logmanager.LogManager"”

Any advice would be appreciated.

Upvotes: 4

Views: 4030

Answers (3)

alparslan
alparslan

Reputation: 173

change in standalone.sh: #!/bin/sh to #!/bin/bash

then

in standalone.conf :

JBOSS_MODULES_SYSTEM_PKGS="org.jboss.logmanager,jdk.nashorn.api,com.sun.crypto.provider,$JBOSS_MODULES_SYSTEM_PKGS"

...

   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

...

BOOT_CP=()
BOOT_CP=("$(find $JBOSS_HOME/modules -type f -name "jboss-logmanager-*.jar")")
BOOT_CP+=("$(find $JBOSS_HOME/modules -type f -name "wildfly-common*.jar")")
for f in $(find $JBOSS_HOME/modules -type f -name "javax.json-*.jar"); do
    BOOT_CP+=("$f")
done
x="-Xbootclasspath/a"
for p in "${BOOT_CP[@]}"; do
    x+=":$p"
done
JAVA_OPTS="-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dsun.util.logging.disableCallerCheck=true $x $JAVA_OPTS"

it is work but I have still some issues...

Upvotes: 0

Prasanth Rajendran
Prasanth Rajendran

Reputation: 5532

I encountered the same issue when I upgrade Wildfly server version from 10.1 to 24.0.0 and I resolved it using the below changes.

The below JAVA_OPTS changes are required to be added at the end of the standalone.conf file

JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/wildfly/common/main/wildfly-common-1.5.4.Final.jar -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.18.Final.jar  -Xbootclasspath/a:$JBOSS_HOME/modules/system/layers/base/org/jboss/log4j/logmanager/main/log4j-jboss-logmanager-1.2.0.Final.jar"

# Enable jmx remote management
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=4447 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false  -Dsun.util.logging.disableCallerCheck=true  -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.local.only=false"

NOTE: wildfly-common-.jar, jboss-logmanager-.jar, log4j-jboss-logmanager-.jar dependencies should be added to classpath using -Xbootclasspath/a

Upvotes: 1

Will Tatam
Will Tatam

Reputation: 572

Use the supplied jconsole.sh script in bin, don't try and build up the classpath by hand. You also need to use the custom service url. See the docs for details

Upvotes: 0

Related Questions