6
votes

Good day, people,

I am trying to use jconsole to connect to remote Wildfly 8 Final servers. That did not work: Connection failed. After multiple tries and failures I attempted to make it connect at least to my 'localhost' jboss, but even that is not working. No errors, it simply doesn't connect and says "Connection failed".

Details:

  1. Wildfly 8 Final server
  2. Using jconsole from wildfly_installation/bin/jconsole.bat
  3. Management users created. Tried with and without the username/password.
  4. The standalone.xml is the original one, shipped with Wildfly 8 Final without changes
  5. The url that I plug in jconsole to connect to is: service:jmx:remoting-jmx://localhost:9999
  6. The Wildfly/jboss doesn't have anything deployed in it, no WARs/EARs.
  7. Java version is 1.7 release 51. The latest on the moment of writing.
  8. JAVA_HOME points to the only java 1.7 installed on the system.
  9. JConsole can connect to local java process and works, but not remote connection.

Basically it's a brand new installation of Wildfly 8 Final with management user created and jconsole doesn't connect remotely to it.

What else I've tried: I've read many posts on people having troubles with jconsole and Jboss AS 7.x. I have tried the suggestions from those threads, but none worked. Also it seems Wildfly 8 has different JMX version (1.3 vs 1.1 in Jboss 7.x), so I assume that's why standalone.xml suggestions from Jboss 7.x didn't work for Wildfly 8 Final.

5

5 Answers

8
votes

Java Mission Control JMX console and Flight Recorder profiler work on WildFly as well.

As already noted the proper JMX connection string is:

service:jmx:http-remoting-jmx://{insert server ip here}:9990

It requires a management user (details on the bottom).

As for the Flight Recorder, these should be added to the server runtime configuration in standalone.conf(.bat):

JAVA_OPTS=%JAVA_OPTS% -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true

On a workstation where you want to run Java Mission Control you need to adjust the classpath in jmc.ini (located in bin directory of your JDK):

-Xbootclasspath/a:c:\Program Files\Java\jdk1.7.0_67\lib\jconsole.jar;c:\Program Files\Java\jdk1.7.0_67\lib\tools.jar;c:\wildfly-8.1.0.Final\bin\client\jboss-cli-client.jar`

Prerequisites (you most likely already configured this):

  1. this assumes that you have installed JDK on workstation in c:\Program Files\Java\jdk1.7.0_67\
  2. this assumes that you have installed WildFly on workstation in c:\wildfly-8.1.0.Final
  3. on the server you need to have proper bind.address configurations (or <any-address>) in standalone.xml:

<interfaces>
    <interface name="management">
        <any-address/>
    </interface>
    <interface name="public">
        <any-address/>
    </interface>
    <interface name="unsecure">
        <any-address/>
    </interface>
</interfaces> 
  1. You need to have a management user on the server, which you can add by using \bin\add-user.bat(.sh).

To test this connect to http://{insert server ip here}:9990 with a web browser which will open the server's web UI console.

Best regards!

6
votes

Alright, got it figured out. The native management port (9999) was removed in the Final version of Wildfly 8. Now there's only 1 management port (9990) and it has multiple previous ports multiplexed over it, including the JMX. It was still available in the release candidate of Wildfly 8, hence all the confusion about the online instructions and configs available elsewhere online.

So the key is to specify the proper protocol, which is not the remoting-jmx now, but http-remoting-jmx. The URL to connect to the server must be like this:

service:jmx:http-remoting-jmx://<server_host_or_ip>:9990

(this is versus service:jmx:remoting-jmx://:9999 in previous jboss/wildfly servers)

Finally, no need to mess with standalone.xml config. All config tweaks to make it work on Jboss 7.x won't work for it. It all works out of the box with proper protocol and port number. Just make sure to create a jboss user in ManagementRealm.

2
votes

This was a bug in WildFly that was recently fixed and will be part of 8.0.1 release.

See jira for more details.

2
votes

You have to include jboss-cli-client.jar in the jconsole classpath:

jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$WILDFLY_HOME/bin/client/jboss-cli-client.jar

Replace $JAVA_HOME to something like /usr/lib/jvm/java-8-oracle/ and $WILDFLY_HOME to /opt/wildfly/ or wherever you have it unpacked.

And then the url is in the following format:

service:jmx:remote+http://${host}:9990

Also fill in the username and password with the credentials configured using add-user.sh

1
votes

Below is how to enable the old native JMX interface, removed from WildFly 8 default configuration, which is backwards compatible with JMX tools.

This is required when the new HTTP interface is not an option, e.g. to integrate with legacy tools like Bamboo's JBoss 7 add-on.

Tested with WildFly 10, it should work with WildFly 8 and WildFly 9 as well.

Since the plug in does not support the HTTP management interface, to make it work, we need to enable the native JMX interface, which used to run on port 9999.

This can be done by adding the native-interface element under the management-interfaces section:

    <management-interfaces>
        <native-interface security-realm="ManagementRealm">
            <socket-binding native="management-native"/>
        </native-interface>
        <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
            <socket-binding http="management-http"/>
        </http-interface>
    </management-interfaces>

And defining the corresponding socket-binding

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="management-native" interface="management" 
                    port="${jboss.management.native.port:9999}"/>
    ...

If in domain mode, to use the remote endpoint, you set use-management-endpoint to false.

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

Hope it may help anyone...

Reference:

https://docs.jboss.org/author/display/WFLY8/Admin+Guide#AdminGuide-NativeManagementEndpoint