How to connect to a remote Karaf instance using JConsole

For this post I’m using Apache Karaf 2.3.5 running on Java 7u60.

In order to connect to a remote Karaf instance you have to pass a service URL. Its format is defined in the etc/org.apache.karaf.management.cfg configuration file:

service:jmx:rmi://${rmiServerHost}:${rmiServerPort}/jndi/rmi://${rmiRegistryHost}:${rmiRegistryPort}/karaf-${karaf.name}

The rmiServerHost and rmiRegistryHost variables should be changed to the hostname or IP address of the remote Karaf instance (or localhost if it’s on the same machine). The default values of the rest of the parts together with the name of the files containing them are shown in the following table:

Variable Default value Configuration file
rmiServerPort 44444 etc/org.apache.karaf.management.cfg
rmiRegistryPort 1099 etc/org.apache.karaf.management.cfg
karaf.name root etc/system.properties

So a complete URL with default values looks like service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-root.

When creating a new JMX connection in JConsole you should enter the service URL and the credentials. Default username and password are karaf/karaf. They are defined in the etc/users.properties configuration file.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.