Connecting to Remote JVM Processes

This section provides a tutorial example on how to use Java VisualVM to monitor JVM processes running on a remote machine with jstatd daemon or JMX agent.

From previous tutorials, we learned how to monitor JVM processes that are running on the local machine. If the JVM process you want to monitor is running on a remote machine, you need use one of the following options:

Here is an example of running LongSleep.java with the JMX agent to allow remote Java VisualVM connections.

1. Run LongSleep.java with the JMX agent turned on without requiring any connection authentication or SSL certificate:

C:\herong>\progra~1\java\jdk1.8.0\bin\java
   -Dcom.sun.management.jmxremote.port=6789 
   -Dcom.sun.management.jmxremote.authenticate=false
   -Dcom.sun.management.jmxremote.ssl=false
   LongSleep

2. Run Java VisualVM and click "File > Add JMX Connection..." menu. You will see a dialog box displayed.

3. Enter "localhost:6789" in the "Connection" field and click OK. You will see that VisualVM connects to the LongSleep.java JVM through the JMS agent.

Once connected, you can monitor the remote JVM in the same way as a local JVM.

The picture below shows File menu entries for connecting Java VisualVM to JVM processes running on a remote machine:
Java VisualVM - Remote Connections

Last update: 2015.

Table of Contents

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

jvisualvm (Java VisualVM) - JVM Visual Tool

 What Is jvisualvm (Java VisualVM)?

 jvisualvm Command to Open Dump Files or Conections

 Connecting Java VisualVM to a Local JVM Process

 Monitoring Usgaes of CPU, Heap, Classes and Threads

 Monitoring Thread Status as Timeline

 Taking Thread Dump to See Thread Stack Traces

 Taking Heap Dump to See Memory Usages

 Viewing a Heap Dump File

Connecting to Remote JVM Processes

 Avaible Plugins and Installation

 Installing Visual GC Plugin

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials

 References

 PDF Printing Version