5

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.

ArtOfWarfare
  • 20,617
  • 19
  • 137
  • 193
  • Are you running WildFly or JBoss EAP 6? WildFly 8+ is a Java EE 7 container and requires Java 7+. – James R. Perkins May 02 '16 at 15:50
  • @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... – ArtOfWarfare May 02 '16 at 15:52
  • @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. :) – ArtOfWarfare May 02 '16 at 18:25
  • 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. – James R. Perkins May 03 '16 at 14:53
  • @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? – ArtOfWarfare May 03 '16 at 15:03
  • @ArtOfWarfare 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. – simon Oct 28 '21 at 11:03

4 Answers4

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.

James R. Perkins
  • 16,800
  • 44
  • 60
  • 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. – ArtOfWarfare May 03 '16 at 16:04
  • 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. – James R. Perkins May 03 '16 at 16:10
  • Okay, I tried with `--cp` instead of `-cp`. No difference. I tried with `remote+http` instead of `http-remoting-jmx`. Also no difference. – ArtOfWarfare May 03 '16 at 16:13
  • 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 https://www.hipchat.com/gSW9XYz69. FWIW `http-remoting-jmx` should work fine. `remote+http` is just the replacement for that. – James R. Perkins May 03 '16 at 16:21
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.

office.aizaz
  • 179
  • 11
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.

kayvan jam
  • 92
  • 8
0

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

satish
  • 1