Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jvisualvm connect to remote jstatd not showing applications

I started a jstatd on the remote server (Ubuntu Server 14.04):

jstatd -J-Djava.security.policy=.jstatd.all.policy -J-Djava.rmi.server.logCalltrue -p 9099

and try to connect to it with jvisualvm on windows. I checked netstat, the connection is established, and on the remote it logs the call:

Sep 11, 2015 12:48:51 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(4)-10.82.199.0: [10.82.199.0: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Sep 11, 2015 12:48:55 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(4)-10.82.199.0: [10.82.199.0: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Sep 11, 2015 12:48:59 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(4)-10.82.199.0: [10.82.199.0: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]

All signs are saying that it's working. but however no applications is showing in jvisualvm:

enter image description here

enter image description here

like image 402
zorro Avatar asked Sep 11 '15 04:09

zorro


People also ask

How do I monitor remote JVM using VisualVM?

There are two ways to connect a remote JVM application to VisualVM: Either using jstatd or Java Management Extensions (JMX). The jstatd program is an RMI server that bundled with the JDK and monitors JVM and provides an interface to allow remote monitoring tools to attach to JVM running on the localhost.

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.)

What is Jstatd connection?

Description. The jstatd command is an RMI server application that monitors for the creation and termination of instrumented Java HotSpot VMs and provides an interface to enable remote monitoring tools to attach to JVMs that are running on the local host. The jstatd server requires an RMI registry on the local host.


2 Answers

Apparently VisualVM expects a consistent DNS name for the server you're trying to connect to remotely (the Ubuntu Server 14.04 in your case). Hence, if you're specifying an IP address instead of a DNS name to VisualVM you should add the following to your jstatd startup line:

-J-Djava.rmi.server.hostname=<the IP address to your Ubuntu server here>

Additionally, I found out that specifying the port option (-p 9099 in your case) is not supported in some VisualVM releases:

Known limitation: In this VisualVM release the jstatd's default port and rminame must be used when starting the jstatd utility, i.e. the use of the -p and -n options is not supported. VisualVM Troubleshooting Guide

All in all, you should try running the following jstatd line on your Ubuntu Server:

jstatd -J-Djava.security.policy=.jstatd.all.policy -J-Djava.rmi.server.hostname=10.82.83.117 -J-Djava.rmi.server.logCalltrue


Sources:

  1. http://www.catify.com/2012/09/26/remote-monitoring-with-visualvm/
  2. It worked for me :)
like image 104
jaime.ferbec Avatar answered Oct 28 '22 06:10

jaime.ferbec


jstatd -p 1099 -J-Djava.rmi.sver.hostname=10.250.105.112 -J-Djava.security.policy=<(echo 'grant codebase "file:${java.home}/../lib/tools.jar" {permission java.security.AllPermission;};')      

Works for Me Perfectly

like image 36
Harsh Maheswari Avatar answered Oct 28 '22 06:10

Harsh Maheswari