Error Sending Text Message to ActiveMQ from Hawtio

Solution Verified - Updated -

Environment

  • apache-activemq-5.9.0.redhat-610379 (Standalone distribution)

Issue

I am unable to send a text message to ActiveMQ from the Hawtio console. The following error occurs:

javax.jms.JMSSecurityException: User name [null] or password is invalid.
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:52)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1405)
    at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1510)
    at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:325)
    at org.apache.activemq.broker.jmx.DestinationView.sendTextMessage(DestinationView.java:347)
    at org.apache.activemq.broker.jmx.DestinationView.sendTextMessage(DestinationView.java:328)
    at org.apache.activemq.broker.jmx.DestinationView.sendTextMessage(DestinationView.java:323)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
    at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        ...

Resolution

The Hawtio console packaged with ActiveMQ exposes operations to send messages to a destination. If you choose to use the "Send text message(java.lang.string)" method on a broker which requires authentication the JMSSecurityException will occur. Instead you should use the "Send text message(java.lang.string,java.lang.string,java.lang.string)" which allows for a username and password to be set.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.