AndreiF
AndreiF

Reputation: 21

jvisualvm for remote host

I want to use jvisualvm's remote functionality to see live stats of a remote JVM. I've started the jvisualvm from my windows machine but I don't know how to configure the remote connection.

On the remote machine (OS: Redhat Linux), tomcat is started with below jmx parameters:
-Dcom.sun.management.jmxremote"
-Dcom.sun.management.jmxremote.port=3030"
-Dcom.sun.management.jmxremote.authenticate=false"
-Dcom.sun.management.jmxremote.ssl=false"

netstat -lnp| grep 3030
tcp  0  0 0.0.0.0:3030  0.0.0.0:*   LISTEN   30728/java

ssh connection is open to remote server and I tunneled the remote port 3030 on a certain local port but when I create new jmx connection (localhost:localport) in jvisualvm I get the below error

Cannot connect to localhost:10000 using service:jmx:rmi:///jndi/rmi://localhost:10000/jmxrmi

Can someone help me to create the connection?

Upvotes: 2

Views: 1024

Answers (1)

Mohit Hapani
Mohit Hapani

Reputation: 59

First of all if you are making a remote connection, localhost connection doesn't make sense.

You need to start jstatd on the remote machine. For this purpose create a jstatd.all.policy file in the home directory of your remote machine and add the following lines:

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

Then on the command line of your remote machine you will type ' jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname={Your Ip address} '

Once jstatd service start on the remote machine you basically add the remote connection Ip address connection on the jvisualVM UI using add remote host.

The Oracle documents for JvisualVM can be referred at https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/applications_remote.html but it is really confusing to understand jstatd steps.

Upvotes: 0

Related Questions