Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to Connect a Remote Host to the VisualVM

Tags:

I am new to Java and I'm facing a problem in connecting a Remote Host to the JVisualVM.

I've searched the Internet and followed all the steps mentioned there but still am not able to resolve the issue. The steps I followed are:

  1. I started the jstatd on the remote server by first creating a jstatd.all.policy file in the $JAVA_HOME/bin. The file contained: grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission;};

  2. I started the Jstatd as jstatd -J-Djava.security.policy=jstatd.all.policy

  3. I started the Java application on the remote host as :

    java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false application_name 
  4. I then started as instance of the JVisualVM on my local machine and as I added the remote host, it got connected but i wasn't able to see any of the Java processes.

Can anyone please help me with this.

Thanks.

like image 520
rushi Avatar asked Oct 24 '11 05:10

rushi


People also ask

How do I connect to a VisualVM remote server?

Connecting to a Remote Host To add a remote host, right-click the Remote node in the Applications window, choose Add Remote Host and type the host name or IP address in the Add Remote Host dialog box. (You can also specify a display name that will be used to refer to the host when listed under the Remote node.)

How add JMX connection to VisualVM?

In Java VisualVM's Applications window, right click on the Local machine and select 'Add JMX Connection'. The Add JMX Connection dialog box opens. The host name localhost is already filled in. You only need to add the port number on which the application is exposed for monitoring and management.

How do I access Java VisualVM?

You can access VisualVM from the bin directory of the JDK: On a Windows system, start VisualVM by double-clicking jvisualvm.exe. You can also select VisualVM from the Start menu (if Windchill shortcuts are installed). On other systems, start VisualVM by invoking the jvisualvm script.

Where can I find VisualVM in JDK?

To find the location of your Java VisualVM userdir, choose Help > About from the main menu and click Details in the About Java VisualVM window.


1 Answers

I encountered similar problems when connecting to Glassfish application server. See solutions that worked for me as they can be same for You:

  • Try setting on your application:

    -Djava.rmi.server.hostname=*Remote_Server_External_IP_Address*

The mentioned IP address should be server external IP (may sound silly but it worked for me). The main problem in my case was JMX pointing to the localhost and looping. In config files the exact IP address should be set to the remote host. I described it as 'Problem 2' In my blog: handling connection problems
  • If Firewall block is an issue then I recommend trying XMing with SSH tunnel (which is simple to set). Here is instruction, if You encounter problems setting it:
    Remote use of VisualVM with Xming (my blog) Biggest advantage of using XMing is that it will work almost always when SSH is enabled. You just have to place VisualVM files on the remote host and run it from command line. XWindow will show VisualVM Window on Your local computer.

  • There is a chance that it is VisualVM issue - try using some other tool just to verify what is wrong. I recommend JConsole. It works similar to VisualVM and I also described details on my blog

like image 185
Jacek Milewski Avatar answered Oct 23 '22 04:10

Jacek Milewski