Connecting VisualVM with a remote JBoss AS 7 / EAP6 JVM process

VisualVM is a useful tool for monitoring and simple profiling of JVM processes. It integrates various command line tools of the JDK such as jstat, jinfo, jstack into a graphical UI. The tool is part of the JDK since 1.6.0_07.

VisualVM start screen
VisualVM start screen

VisualVM discover local and remote JVM processes. There are two different way to connect a remote host and JVM processes:

  1. jstatd connection
  2. jmx connection

To auto discover remote processes it is necessary to start a jstat daemon with the appropriate security policy for native permissions. But this is out of scope in this post. We will cover and explain how to create a JMX connection to an EAP6 instance or respectively a JBoss AS7 instance with VisualVM. This has also the benefit, that we can use more capabilities of VisualVM and we get more information for profiling.

Connecting a remote EAP6 / AS7 JVM process

Connecting VisualVM to a remote EAP6 / AS7 JVM process is quit easy. The application server supports the JMX Remote API for remote management and monitoring (JSR 160). Therefor, JBoss implements a JSR 160 compliant JMXConnector instead of an RMI interface to establish a connection to a JMX MBeanServer form a remote client. There is no need for any additional JVM options. The JMXConnector uses under the hood JBoss Remoting for the transport and by default the native management endpoint of the AS7 if the server is running in the standalone mode. To access the management endpoints a management user in the realm ManagementRealm is required. If no user exists, you can use the add-user script from the EAP6 / AS7 distribution. You can create a user as follows:

$JBOSS_HOME/bin/ username password

If you are running your server or multiple server instances in the domain mode the JMXConnector uses the remoting connector. To establish a connection over the remoting connector a user in the realm ApplicationRealm is required. You can create a user for the ApplicationRealm with the option -a as follows:

$JBOSS_HOME/bin/ -a username password

The configuration is located in the JMX subsystem. You can use the command line interface (CLI) of the application server to see a full description of all possible configurations:

[disconnected /] connect --controller 
[standalone@hostname:9999 /] /subsystem=jmx :read-resource-description(recursive=true)

Note that the management interface must be accessible in both modes from a remote client. You can bind the management interfaces at server startup by setting this system property:

Standalone Mode

$JBOSS_HOME/bin/ –

Domain Mode

$JBOSS_HOME/bin/ –

Starting VisualVM with the necessary libraries to connect JMX over JBoss Remoting

As already mentioned before, the JMX MBeanServer is accessible using JBoss Remoting through the management connection. Therefore, it is necessary to add the following libaries from the modules directoriy of the EAP6 / AS7 distribution to the classpath of VisualVM:

  • org/jboss/remoting3/remoting-jmx
  • org/jboss/remoting3
  • org/jboss/logging
  • org/jboss/xnio
  • org/jboss/xnio/nio
  • org/jboss/sasl
  • org/jboss/marshalling
  • org/jboss/marshalling/river

To start VisualVM, you can also use the attached script and copy it into the bin directory of the EAP6 / AS7 distribution.


Configure VisualVM for a remote connection

The next step is to add a Remote Host as shown in the following screenshots of VisualVM.

visualvm - add a remote host
add a remote host (1)
visualvm - add a remote-host
add a remote host (2)

After that you need to configure a JMX connection as shown in the screenshot below. We need to use a JMX Service URL to identify the JSR-160 compliant JMXConnectorServer of the AS7 to establish a connection from VisualVM with the form service:jmx:PROTOCOL://IP:PORT.

visualvm - add jmx-connection
add jmx-connection (1)
visualvm - add jmx connection over jboss remoting
add jmx connection over jboss remoting (2)

The service URL begins always with service:jmx: followed by the protocol, host and port. The protocol is JBoss specific and named remoting-jmx. If you are running the server in the standalone mode the default port of the native management interface is 9999. The default port of the remoting connector in the domain mode is 4447 plus port offset, if configured.

For authentication the credentials of the management user in standalone mode or the credentials of the application user in domain mode are required.

After a successful connection via JMX, you should see the following screen.

Connecting visualvm with jbossas7 remote jvm process
VisualVM screen after a successful connection

That’s it! Feel free to contact us for any questions or feedback.
heinz.wilming (at)

16 thoughts on “Connecting VisualVM with a remote JBoss AS 7 / EAP6 JVM process

  1. This is how I managed to have the JVisualVM working on Windows:

    Assuming you have JBoss EAP 6.1 in the folder C:\Program Files\Java\jboss-eap-6.1\
    Finally, I assigned some extra memory in order to analyze a bigger heap fump (4GB).
    The -J-Xms4096m -J-Xmx4096m -J-XX:MaxPermSize=512m parameters are optional.

    jvisualvm -J-Xms4096m -J-Xmx4096m -J-XX:MaxPermSize=512m -cp:a “C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\remoting-jmx\main\remoting-jmx-1.1.0.Final-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\remoting3\main\jboss-remoting-3.2.16.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\logging\main\jboss-logging-3.1.2.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\xnio\main\xnio-api-3.0.7.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\xnio\nio\main\xnio-nio-3.0.7.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\sasl\main\jboss-sasl-1.0.3.Final-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\marshalling\main\jboss-marshalling-1.3.16.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\modules\system\layers\base\org\jboss\marshalling\river\main\jboss-marshalling-river-1.3.16.GA-redhat-1.jar”;”C:\Program Files\Java\jboss-eap-6.1\bin\client\jboss-client.jar;C:\Program Files\Java\jboss-eap-6.1\bin\client\jboss-cli-client.jar”

  2. Hi, I am trying to connect a remote jboss server using visualVM. I am trying to use JMX connector. I do not have root access to the server and cannot run the visualvm.bat file which is mentioned in this post. So I am running the visualvm downloaded in my local machine and trying to connect jboss server. So could you please help me in connecting as I connot access the JBoss server.

  3. Hi and thanks for the post!
    Isn’t possibile to connect without authentication?

  4. Hi,

    I started Jboss 7 server, while accessing jvisualvm, jboss is not displaying at Local section.

    Can u tell possible reasons?


  5. I constantly get the ` Unsupported protocol: remoting-jmx` exception. Any ideas?

    1. Only need jboss-client.jar! `jvisualvm –cp:a “$JBOS_HOME/bin/client/jboss-client.jar”` Works perfectly!

  6. After struggling for some time, we managed to follow these instructions but we found that a JAR expected to be found in org/jboss/remoting3/remoting-jmx was actually found in org/jboss/remoting-jmx in the JBoss EAP 6.1 we installed locally. After updating jvisualjm.bat accordingly (update call to SearchForJars), we managed to connect to our JBoss instance.

    1. I also had the same issue and this helped me a lot in connecting to the remote jvm

  7. Hi,
    Thank you for the post. Can you also provide the script for Windows for setting the classpath JARs for VisualVM?


    1. I am curious if you ever did get a Windows version of the VisualVM script. Please let me know.

      1. Hi,

        the best way is to copy the jconsole.bat file and change the line
        “%JAVA_HOME%\bin\jconsole.exe” “-J-Djava.class.path=%CLASSPATH%”


        “%JAVA_HOME%\bin\jvisualvm.exe” “–cp:a” “%CLASSPATH%”

        Cheers, Heinz

  8. Do you know if there are any problems when using your method via a SOCKS proxy ? I tried it (because I have a machine behind firewalls where the JBoss AS 7.1.1 is started) and the connection always fails…I did not manage to access it remotely (but web console with my browser configured to use the proxy works).

    Thanks for your guide 😉


  9. Is there a way to get the MBeans via RMI or JMXMP?
    Using remoting-jmx with all it’s dependencies is not quite fun for monitoring applications. Thanks for the article.

Comments are closed.