【发布时间】:2013-10-06 05:52:03
【问题描述】:
我正在使用Apache ActiveMQ version 5.8.0,我下载了Apache ActiveMQ Browser version 2.5.2.8
在 Apache ActiveMQ 中,我编辑了 activemq.xml 配置以使用 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>
在启动脚本中,我将 JMX 设置如下:
#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"
当我重新启动 Apache ActiveMQ 时,日志显示 JMX 已启动并可访问:
JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi | org.apache.activemq.broker.jmx.ManagementContext | JMX connector
同时检查端口是否正在监听结果到监听端口:
[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 正在服务器上运行。例如在 IP 10.0.0.100 上。 Apache ActiveMQ 浏览器在我的 PC (10.0.0.200) 上运行。
当我尝试连接 Apache ActiveMQ 浏览器时,连接一直失败。我正在使用以下设置:
JMX URL: service:jmx:rmi:///jndi/rmi://10.0.0.100:1099/jmxrmi
JMX role: admin
JMS password: activemq
此时我在 jmx.password 和 jmx.access 中保留了默认用户名和密码。
我还尝试在使用 putty 连接时为端口 1099 创建一个隧道到本地端口 1099,然后连接到 localhost 而不是 10.0.0.100 以确保没有防火墙是问题。但一切都失败了。
我是不是忘记了什么?
【问题讨论】: