Apache ActiveMQ browser can't connect to JMX console

Mark Veenstra picture Mark Veenstra · Sep 30, 2013 · Viewed 21.2k times · Source

I am using Apache ActiveMQ version 5.8.0 and I downloaded Apache ActiveMQ Browser version 2.5.2.8

Within Apache ActiveMQ I edited the activemq.xml configuration to use JMX:

<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" brokerName="localhost" dataDirectory="${activemq.data}">
  <!-- This needed to be set to true, otherwise JMX won't start in 5.8.0 -->
  <managementContext>
    <managementContext createConnector="true"/>
  </managementContext>
</broker>

Within the startup script I set the JMX settings as follows:

#ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=11099 "
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"

When I restart Apache ActiveMQ, the log shows me the JMX is started and accessible:

JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi | org.apache.activemq.broker.jmx.ManagementContext | JMX connector

Also checking if the port is listening results into a listening port:

[me@server ~]$ netstat -lptun | grep 1099
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 :::1099                     :::*                        LISTEN      16775/java

Apache ActiveMQ is running on a server. For example on IP 10.0.0.100. Apache ActiveMQ Browser runs on my PC (10.0.0.200).

When I try to connect with Apache ActiveMQ Browser the connections keeps failing. I'm using the following settings:

 JMX URL: service:jmx:rmi:///jndi/rmi://10.0.0.100:1099/jmxrmi
 JMX role: admin
 JMS password: activemq

I left the user and password at this moment as default in jmx.password and jmx.access.

I also tried when connecting with putty to create a tunnel for port 1099 to local port 1099 and then connect to localhost instead of 10.0.0.100 to be sure no firewall is the issue. But all fails.

Am I forgetting anything?

Answer

JB- picture JB- · Oct 4, 2013

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.