ArtOfWarfare
ArtOfWarfare

Reputation: 21486

Connect JVisualVM to a Remote Wildfly Instance?

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.

Upvotes: 6

Views: 8870

Answers (4)

office.aizaz
office.aizaz

Reputation: 191

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.

Upvotes: 3

satish
satish

Reputation: 1

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

Upvotes: 0

kayvan jam
kayvan jam

Reputation: 92

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.

Upvotes: 0

James R. Perkins
James R. Perkins

Reputation: 17780

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.

Upvotes: 7

Related Questions