Not able to connect Wildfly 26 Remote server JMX, issue with jboss-logmanager

1,291 views
Skip to first unread message

praneeth kumar

unread,
May 14, 2023, 1:27:00 PM5/14/23
to WildFly
Hi Team,
I am struggling to fix this issue, it would be a great help .

Issue : not able to connect remote wildfly servers JMX connections.

softwares used : 
amazon correto idk 11.0.16.9.1
Wildfly 26.1.2.Final
Note : I am able to connect from visualvm, but not from java client program. 
JMX Url : service:jmx:remote+http://<HOST-IP>:9990

Standalone.conf JAVA_OPTS : 
===================
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   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.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
   JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:/opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar -classpath /opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar "
   JAVA_OPTS="$JAVA_OPTS --module-path=/opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar"
   JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=org.jboss.logmanager"
   JAVA_OPTS="$JAVA_OPTS --add-modules=org.jboss.logmanager"
   JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
   JAVA_OPTS="$JAVA_OPTS -classpath /opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar:$CLASSPATH"
   JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:/opt/standalone/test/plain/wildfly-26.1.2.Final/bin/client/jboss-client.jar"
   JAVA_OPTS="$JAVA_OPTS --add-exports=java.base/org.jboss.logmanager=ALL-UNNAMED"


when I try to add jmx java opts it fails with log manager. 
module org.jboss.logmanager is not found error.
when I google about it, this jar is not having module-info.class might be the reason.

please suggest me if there is any approach.

Thank you in advance!.

Regards,
Praneeth Ganji.

Bartosz Baranowski

unread,
May 15, 2023, 2:34:41 AM5/15/23
to WildFly
Hey.
Im fairly sure connecting  with JDK console did not require such elaborate changes. Though it has been quite some time since I had to do it. Anyway, could you please describe in detail your set up and what are you trying to achieve?
Reason Im asking is my claim above and fact that Im tad thrown off by you JAVA_OPTS:
 -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS 
vs 
-Djboss.modules.system.pkgs=org.jboss.logmanager"

 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
...
 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"

 -Xbootclasspath/a:/opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar -classpath /opt/standalone/test/plain/wildfly-26.1.2.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.19.Final.jar "
vs
-Xbootclasspath/a:/opt/standalone/test/plain/wildfly-26.1.2.Final/bin/client/jboss-client.jar"


https://docs.oracle.com/cd/E15289_01/JRCLR/optionx.htm#i1021218 --> "The -Xbootclasspath/a option is similar to -Xbootclasspath in that it specifies a list"

praneeth kumar

unread,
May 15, 2023, 3:04:50 AM5/15/23
to WildFly
Hi Bartosz Baranowski, thank you for the quick response.

My goal is to establish the JMX connection to the remote wildfly server to access MBeans, but I am facing the SaslException.

here is the code snippet when I try.

MBeanServerConnection peerConnection;
JMXConnector peerConnector;

String jmxUrl = "service:jmx:remote+http://<remote-host>:9990";
JMXServiceURL serviceURL = new JMXServiceURL(jmxUrl);
Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put(Context.SECURITY_PRINCIPAL, "user");
properties.put(Context.SECURITY_CREDENTIALS, "password");

peerConnector = JMXConnectorFactory.connect(serviceURL, properties);
peerConnection = peerConnector.getMBeanServerConnection();


Error Log : 
=========
INFO: ELY00001: WildFly Elytron version 1.19.1.Final
javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:
   JBOSS-LOCAL-USER: javax.security.sasl.SaslException: ELY05128: Failed to read challenge file [Caused by java.io.FileNotFoundException: \opt\standalone\wildfly-26.1.2.Final\standalone\tmp\auth\local2930088693933642590.challenge (The system cannot find the path specified)]

    at org.jboss.remoting3.remote.ClientConnectionOpenListener.allMechanismsFailed(ClientConnectionOpenListener.java:109)
    at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:445)
    at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:244)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)



Regards,
Praneeth.

James Perkins

unread,
May 15, 2023, 5:06:37 PM5/15/23
to WildFly
You should be configuring JMX with the subsystem https://docs.wildfly.org/26.1/Admin_Guide.html#JMX

Are you attempting to just launch JMX or are you attempting to programmatically configure something? There is a $JBOSS_HOME/bin/jconsole.sh script that will load JConsole.

praneeth kumar

unread,
May 15, 2023, 8:58:33 PM5/15/23
to WildFly
Hi James,
I am running on standalone mode and enabled JMX subsystem.

my goal is  to access the mbeans on the remote wildfly server and invoke them, for this I would need the JMX connection.

James Perkins

unread,
May 16, 2023, 10:42:30 AM5/16/23
to WildFly
You've got system properties set in the standalone.conf which affect starting WildFly in standalone mode. Those should not be used. The -classpath won't work as WildFly uses JBoss Modules. I'm not sure what the JMX settings would do, but really JMX needs to be configured through the subsystem.

As far as your example, you're using the wrong environment settings. I assume that Context is javax.naming.Context which doesn't really relate to JMX. You need to use the JMXConnector.CREDENTIALS which is a string array. Something like:
properties.put(JMXConnector.CREDENTIALS, new String[] {"user", "password"});

praneeth kumar

unread,
May 17, 2023, 12:24:54 AM5/17/23
to WildFly
Hi @James, a big thanks to you :).

after applying above change JMXConnector.CREDETIALS, program started working without any of those JAVA_OPTS.

thank you so much.

Regards,
Praneeth Ganji.

Reply all
Reply to author
Forward
0 new messages