Apache ActiveMQ browser can't connect to JMX console

♀尐吖头ヾ 提交于 2019-11-28 21:31:02

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>

For me I got this: Connection refused to host: ; nested exception is: .... even though it was TCP listening on its jmx port.

Seems I also needed -Djava.rmi.server.hostname=my.local.ip.address then it worked with normal connect url

 service:jmx:rmi:///jndi/rmi://host:your_jmxremote_port/jmxrmi

not sure why...

Possibly also needed this on activemq side, not sure:

--jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:11099/jmxrmi
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!