Search code examples
activemq-artemisjolokia

How to get rid of InstanceNotFoundException ArtemisJMXSecurity when using embedded ActiveMQ Artemis?


I use an embedded instance of ActiveMQ Artemis 2.33.0 as part of a Spring Boot project.

I can connect to that embedded instance from an external deployment of the web console (Hawtio), but every time I connect, my Spring Boot process throws below error in my process log:

ERROR: jolokia-actuator-endpoint: Error 404
javax.management.InstanceNotFoundException: hawtio:type=security,area=jmx,name=ArtemisJMXSecurity

How can I prevent my process from throwing that Exception?


Solution

  • The ActiveMQ Artemis web console looks for the hawtio:type=security,area=jmx,name=ArtemisJMXSecurity MBean to verify management authorization. If you want to enable this then I believe that when you start Java you need to set the system property javax.management.builder.initial to either:

    • org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerGuard
    • org.apache.activemq.artemis.core.server.management.ArtemisRbacMBeanServerBuilder

    For example:

    java ... -Djavax.management.builder.initial=org.apache.activemq.artemis.core.server.management.ArtemisMBeanServerGuard ...
    

    The ArtemisMBeanServerGuard will automatically give you permissions for three different roles:

    • amq: users with this role will have full control to view & update MBean attributes, execute management operations, etc.
    • view: users with this role will be able to view MBean attributes and list data, but won't be able to change anything
    • update: like the view role, but with the ability to update MBean attributes

    You can provide a custom configuration via a file called management.xml, but that would require configuring a handful of additional classes that I'm not would be easy to do in Spring Boot.

    The ArtemisRbacMBeanServerBuilder is discussed in the documentation. It's easier to configure since it reads its configuration directly from security-settings which you can configure either via broker.xml or the embedded configuration API.