Apache ActiveMQ browser can't connect to JMX console

Unfortunately, JMX needs two ports to operate properly. And the second one (the RMI registry port) is by default picked randomly causing problems with firewalls etc.

Since JDK7u4 you can use

-Dcom.sun.management.jmxremote.rmi.port=<port>

to set the RMI port to be used.


After hours of suffering. The magic to connect behind a firewall.

<managementContext>
  <managementContext createConnector="true" rmiServerPort="1098"  connectorPort="1099"  />
</managementContext>

Sample connection string:

service:jmx:rmi://10.0.4.14:1098/jndi/rmi://10.0.4.14:1099/jmxrmi

If you are restricted by JDK version, so cannot use -Dcom.sun.management.jmxremote.rmi.port, you can alternatively specify the RMI registry port in the managementContext itself.

<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" brokerName="localhost" dataDirectory="${activemq.data}">
    ...
    <managementContext>
        <managementContext connectorPort="1099" rmiServerPort="<port>" />
    </managementContext>
    ...
</broker>

Tags:

Activemq

Jmx