Spartan Daminator
Spartan Daminator

Reputation: 3

How to connect to ActiveMQ Artemis via JConsole?

I am trying to connect via JConsole to ActiveMQ Artemis. However, it doesn't seem to work.

I have tried the following URLs both with and without user/password (admin/admin).:

service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi 

and

service:jmx:rmi:///jndi/rmi://0.0.0.0:1099/jmxrmi

My broker is running locally. I just unzipped it and created an instance. Here is my management.xml:

<management-context xmlns="http://activemq.org/schema">
  <connector connector-port="1099"/>
   <authorisation>
      <whitelist>
         <entry domain="hawtio"/>
      </whitelist>
      <default-access>
         <access method="list*" roles="amq"/>
         <access method="get*" roles="amq"/>
         <access method="is*" roles="amq"/>
         <access method="set*" roles="amq"/>
         <access method="*" roles="amq"/>
      </default-access>
      <role-access>
         <match domain="org.apache.activemq.artemis">
            <access method="list*" roles="amq"/>
            <access method="get*" roles="amq"/>
            <access method="is*" roles="amq"/>
            <access method="set*" roles="amq"/>
            <access method="*" roles="amq"/>
         </match>
         <!--example of how to configure a specific object-->
         <!--<match domain="org.apache.activemq.artemis" key="subcomponent=queues">
            <access method="list*" roles="view,update,amq"/>
            <access method="get*" roles="view,update,amq"/>
            <access method="is*" roles="view,update,amq"/>
            <access method="set*" roles="update,amq"/>
            <access method="*" roles="amq"/>
         </match>-->
      </role-access>
   </authorisation>
</management-context>

I have tried the following:

  1. Uncommented <connector connector-port="1099"/> in management.xml file
  2. Uncommented in artemis-service.xml:
    <!-- uncomment this if you want to connect jconsole to connect -->
    <argument>-Dcom.sun.management.jmxremote</argument>
    <argument>-Dcom.sun.management.jmxremote.port=1099</argument>
    <argument>-Dcom.sun.management.jmxremote.ssl=false</argument>
    <argument>-Dcom.sun.management.jmxremote.authenticate=false</argument>
    
  3. Add in artemis-service.xml:
    <argument>-Dcom.sun.management.jmxremote.rmi.port=1099</argument>
    

Upvotes: 0

Views: 1503

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 34973

I just got this working in ActiveMQ Artemis 2.6.2 by doing the following:

  1. Download and unzip ActiveMQ Artemis 2.6.2 to <ACTIVEMQ_HOME>
  2. Open a terminal and run cd <ACTIVEMQ_HOME>/bin
  3. Create a new broker instance using ./artemis create ~/testJMX --user myUser --pass myPass --require-login
  4. Uncomment <connector connector-port="1099"/> in etc/management.xml.
  5. Start the broker using ./artemis run
  6. Start JConsole using the jconsole command.
  7. Point JConsole to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi using myUser & myPass for the username & password respectively.
  8. Observe that JConsole connects properly and all MBeans are accessible.

I used JDK 1.8 on Linux. I don't have a Windows box I can test with.

It is also possible to get this working by changing steps #4 & #7 slightly:

  1. Download and unzip ActiveMQ Artemis 2.6.2 to <ACTIVEMQ_HOME>
  2. Open a terminal and run cd <ACTIVEMQ_HOME>/bin
  3. Create a new broker instance using ./artemis create ~/testJMX --user myUser --pass myPass --require-login
  4. Remove all of the contents of the management-context element in etc/management.xml so that you're left only with this:
    <management-context xmlns="http://activemq.org/schema" />
    
  5. Start the broker using ./artemis run
  6. Start JConsole using the jconsole command.
  7. Point JConsole to the local ActiveMQ Artemis process.
  8. Observe that JConsole connects properly and all MBeans are accessible.

In general, I recommend you move to the latest version. ActiveMQ Artemis 2.6.2 was released almost 3 years ago now. Since 2.6.2 was released the JMX properties have been removed from artemis-service.xml as they are no longer applicable. See ARTEMIS-2112 for more details.

Upvotes: 1

Related Questions