smartnut007
smartnut007

Reputation: 6423

JVM remote profiling with JVisualVM

I am trying to profile my jvm applications on a remote host. I am using Jvisualvm I setup jstatd as recomended in this (link removed, leads to phishing website). I am able to "telnet remotehost 1099" successfully. All the tcp/ip ports are firewall open on the remote.

I added my remote host in jvisualvm. Also, made sure the jstatd port is the 1099 with a refresh of 3 secs.

I started my application with

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=8011 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

But, my jvm applications dont show up in my jvisualvm. Is there anything else I need to configure or check ?

jvisualvm 1.3.5 local: Mac OSX Oracle jdk 1.6.37 remote: centos 6 oracle jdk 1.6.24

Upvotes: 1

Views: 9554

Answers (2)

Mohit Hapani
Mohit Hapani

Reputation: 59

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: 1

Cratylus
Cratylus

Reputation: 54094

1) You should start your application with JMX enabled
Example for remote connection

-Dcom.sun.management.jmxremote    
-Dcom.sun.management.jmxremote.port=9990   
-Dcom.sun.management.jmxremote.authenticate=false   
-Dcom.sun.management.jmxremote.ssl=false  

2) You should have JMX classes to be able to do something with them. I suppose you are aware of this

Upvotes: 1

Related Questions