Tuesday, March 14, 2017

Using JVisualVM to connect to a remote Weblogic 12c Managed Server

Environment / assumptions for this post:

  • Weblogic 12c Managed Server(s)
  • jdk7 / 8
  • Oracle Enterprise Linux 7.2
  • Cygwin on Windows 7

Where I work we have many servers running various versions of Weblogic (mostly 12c but still some 11g) and Hotspot VM with jdk7 and jdk8, all on OEL (Oracle Enterprise Linux). It can be really useful to monitor threads or memory, browse the MBeans, etc.  Using JConsole used to be the way to go, but JVisualVM monitoring tool has been available since the later releases of jdk6 and is more flexible.  It doesn't do MBeans from the get-go, but has a plug-in system that makes it very easy to "turn on" right away along with some other useful plugs. Once you get the tool running, you simply "install" the plugin with a few clicks - it ends up in the user's home folder under ~/.visualvm.

List of JVisualVM plugins available with just a few clicks

There are several ways to run the tool and connect to a remote JVM, some of which are quite complicated - you may have to worry about setting JVM system properties (which may not be possible!), then there is authentication, SSL and keystore issues, firewall issues, and more.  See this Oracle documentation for some additional information.

Another way is to connect locally to the PID of the JVM. This means either logging in to the server's GUI if possible, or running your own X server and simply displaying the remote JVisualVM on your local machine. This last way I've found to be fairly easy to setup (the only thing is it assumes you have shell access to the remote server), and gives many advantages:

  • do not have to restart the JVM with the system properties required;
  • less issues around SSL and security;
  • can easily pick any JVM on a server by selecting its PID

To set this up, see Option 2 in another of my posts. Once this is done, you can install some plugins and get monitoring!

Some of the plugins available:

MBean plugin

JVisualVM MBean plugin


Visual GC plugin

JVisualVM - Visual GC plugin


Threads Inspector plugin

JVisualVM Threads Inspector plugin