Connect JVisualVM to a Remote Wildfly Instance?
Asked Answered
A

4

6

I'm trying to connect JVisualVM, running on my local machine, to a remote machine which is running a WildFly server (version 8.1.0, to be specific.)

I didn't configure the WildFly server myself, and I don't know who did, but I do know that I can log in as an administrative user from my local machine by pointing my browser at:

https://[ip address of the remote machine]:9443/console

Note that it's https, not ordinary http, and that the port for that has been set to 9443 (I think the default is 8080 or 9990 or something... IDK, I saw a lot of port numbers online. I have been explicitly told that http was disabled for this WildFly server).

I can SSH into the remote machine. I can navigate to the bin directory for WildFly and run jboss-client.sh. I have to connect on port 9999 (I think the default is 9990 for that?)

I copied the jboss-client.jar (under bin/client) to my local machine and ran JVisualVM from the command line like this:

.\jvisualvm.exe -cp:a C:\[path to]\jboss-client.jar

It launches fine. File > Add Remote Host: Then I entered the IP. OK. I right clicked on it under Remote in the tree and picked Add JMX Connection. I entered

service:jmx:http-remoting-jmx://[ip]:9999

I checked off that I wanted to use the security credentials and entered the username and password. Checked off to save the security credentials. Left "Do not require SSL Connection" unchecked. Hit OK. It immediately spat out the message

Cannot connect to admin@service:jmx:http-remoting-jmx://[ip]:9999 using service:jmx:http-remoting-jmx://[ip]:9999

I also tried the port 9443, 9990, and 8080 instead. None of those worked. I tried https instead of http in the protocol name. That also didn't work.

What am I missing? How is it that I can access the console, and connect with jboss-client.sh, but I can't use JVisualVM? Is there some log I can use somewhere to see what's wrong? Maybe someone can point out a configuration I've missed somewhere?

Not sure if it's important or not, but my local machine is running Windows 10 with JDK8 installed. The WildFly server is using Java 6 on CentOS 6.3.

Allometry answered 29/4, 2016 at 20:26 Comment(6)
Are you running WildFly or JBoss EAP 6? WildFly 8+ is a Java EE 7 container and requires Java 7+.Hole
@JamesR.Perkins - The server is definitely running WildFly 8.1.0. I will check on the Java version, but I'm pretty sure it's 6...Allometry
@JamesR.Perkins - Okay. Turns out that both Java 6 and Java 8 are installed on the server. WildFly 8.1.0 is using the Java 8 install... I'm not sure why the server also has Java 6 installed separately. Anyways, hope clarifying that helps you help me. :)Allometry
Is the management port listening on an IP that's accessible? For example can you connect with CLI? FWIW port 9990 is the default management port for WildFly.Hole
@JamesR.Perkins - Yes, I can connect the CLI from my local, Windows machine, to the remote server, on port 9999. Also, I can run JVisualVM on the remote server and have it connect to its own Wildfly instance. That might be good enough for me... having it run remotely would be preferred, but if this is the best I can do... maybe I can live with that?Allometry
@Allometry Did you find a solution? I have the same problem, and have tried countless suggestions and combinations of configurations and connect string syntaxes, with no luck this far.Crestfallen
H
7

You need to add the jboss-client.jar (or jboss-cli-client.jar) to the class path for JVisualVM. The library can be found in the bin/client directory of the WildFly install.

I used the following command to add the library to the class path.

jvisualvm --cp:a ~/servers/wildfly-10.0.0.Final/bin/client/jboss-client.jar

Then I used service:jmx:remote+http://[ip]:[port] and was able to connect.

Hole answered 3/5, 2016 at 16:1 Comment(4)
Wow this is insulting. I took the effort to write and format everything I've done, but you couldn't be bothered to read it.Allometry
Sorry it wasn't meant to be insulting. One difference I noticed in our commands, maybe just a Windows vs Linux thing, but you used -cp and when I ran the help it used --cp. The fact it returns immediately seems to indicate it can't find the protocol. At least that's my best guess.Hole
Okay, I tried with --cp instead of -cp. No difference. I tried with remote+http instead of http-remoting-jmx. Also no difference.Allometry
I can't recall, but does VisualVM log exceptions? Returning immediately just seems suspicious to me. Feel free to join on freenode IRC #wildfly or HipChat hipchat.com/gSW9XYz69. FWIW http-remoting-jmx should work fine. remote+http is just the replacement for that.Hole
H
3

I don't know if someone else is also (still) having the same issue (Wildfly10 on a remote machine where management console is available at 9443 with HTTPS). The following worked for me.

For ssh connections:

  1. Starting jvisualvm with jboss-client.jar
jvisualvm --cp:a @JBOSS_HOME/bin/client/jboss-client.jar
  1. Using the following connection string:
service:jmx:remote+https://remote-server:9443

NOTE: I used here remote+https

  1. Provide username and password

Hope this helps.

Halstead answered 1/7, 2019 at 8:31 Comment(0)
L
0

you missed run jstatd command in remote host , this little program is RMI server that possible connection from client to remote host though you using jmx connection it used jmxrmi protocol for that connection .

so first in remote host create file name as security.policy with this contain :

grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};

off course you must in file section for linux put explicit path and then of creation this file put it in bin directory of jdk.home

then you should run this command on remote host $JAVA_HOME/bin/jstatd -J-Djava.security.policy=path of /security.policy -J-Djava.rmi.server.hostname=remote ip address -J-Djava.net.preferIPv4Stack=true then you could connect to server off course with correct settings.

Laminate answered 1/10, 2016 at 6:7 Comment(0)
Y
0

Include jboss-cli-client.jar and jboss-client.jar under \lib\visualvm\platform\lib and restart jvisualvm to pickup new jars.

Yuan answered 3/10, 2017 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.