简体   繁体   中英

JBoss HornetQ JMX access

We have HornetQ messaging running inside JBoss. From a remote VM we are unable to connect using JMXURL.

HornetQ settings (hornet1 configuration.xml):

<jmx-management-enabled>true</jmx-management-enabled>

JBoss settings

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

From a remote JVM none of these URLs work:

  • service:jmx:rmi:///jndi/rmi://localhost:8070/jmxrmi
  • service:jmx:rmi:///jndi/rmi://127.0.0.1:8007/jmxconnector

As for JBoss 6.0.0

jconsole service:jmx:rmi://localhost/jndi/rmi://localhost:1090/jmxconnector

works. If you replace localhost with your host address, it worked as well.

Note that I started JBoss using

run.sh -c whatever --host=0.0.0.0

so that JBoss binds to all interfaces/addresses (instead of localhost only):

--host=host_or_ip ... Bind address for all JBoss services

I have changed the run.sh to :

export JMX_ARGS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
java $JVM_ARGS -classpath $CLASSPATH $JMX_ARGS  org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME

then when hornetq starts you should see this in the log :

15:15:22,312 CONFIG [sun.management.jmxremote] JMX Connector ready at: service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi

on the client side you should be able to connect to the server with this :

val url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi")
val connection = JMXConnectorFactory.connect(url, new java.util.HashMap())
def mbeanServer = connection.getMBeanServerConnection()
val objectName = new ObjectName("org.hornetq:module=Core,type=Server")
val serverInfo = mbeanServer.getMBeanInfo(objectName)
println(serverInfo.getDescription())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM