Is your ActiveMQ Web console throws an exception while you are trying to view/browse the messages? Is it similar to what you see below, then this article could help you solve it. Good Luck
The Problem:
When the Active MQ broker is Secured and when you are trying to browse the Contents of Queue (or) Topic through the web console. You may encounter the following error/ exception.
" Exception occurred while processing this request, check the log for more information! "
When you go and check the activemq.log in the data directory, you may see the following exception
2018-05-07 12:13:41,028 | INFO | Connector vm://localhost started | org.apache.activemq.broker.TransportConnector | qtp61137731-42 2018-05-07 12:13:41,041 | WARN | Failed to add Connection id=ID:Saravanans-Air-53261-1525674467606-4:6, clientId=ID:Saravanans-Air-53261-1525674467606-3:6 due to {} | org.apache.activemq.broker.TransportConnection | ActiveMQ VMTransport: vm://localhost#11-1 java.lang.SecurityException: User name [system] or password is invalid. at org.apache.activemq.security.JaasAuthenticationBroker.authenticate(JaasAuthenticationBroker.java:97)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:68)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:99)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:843)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:330)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:194)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:275)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)[activemq-all-5.15.3.jar:5.15.3] at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)[activemq-all-5.15.3.jar:5.15.3] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_152] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_152] at java.lang.Thread.run(Thread.java:748)[:1.8.0_152] 2018-05-07 12:13:41,065 | WARN | Security Error occurred on connection to: vm://localhost#10, User name [system] or password is invalid. | org.apache.activemq.broker.TransportConnection.Service | ActiveMQ VMTransport: vm://localhost#11-1
The Solution:
We presume that you are using inbuilt JAAS authentication to secure the broker If you are using the AD or external authentication you can directly go to Step 4 and Step 5.
Note*: All the configurations files mentioned here supposed to be available at activemq/conf/ directory
Step1
Get the configuration name from the activemq.xml file
<plugins> <jaasAuthenticationPlugin configuration="activemq"/> </plugins>
Here my configuration name is activemq ( highlighted one in the preceding snippet
Step2
In the login.config file of yours, find the directive/grouping named activemq. It will be something like this
activemq { org.apache.activemq.jaas.PropertiesLoginModule required org.apache.activemq.jaas.properties.user="users.properties" org.apache.activemq.jaas.properties.group="groups.properties"; };
Step3
Get the password for your desired user ( in my case its admin ) from the users.properties file ( as it was given as a value for org.apache.activemq.jaas.properties.user in the login.config file)
admin=c0mp!ex@01
Left to the equal sign is your name and to the right is your password, in my case, my password is c0mp!ex@01 and admin is my username
Step4
Open the credentials.properties. This file is used to let the Activemq web console know the username and password it should use while trying to access the broker resources like Queue and Topic
by default, the file might contain values like given below
activemq.username=system activemq.password=manager guest.password=password
Replace the activemq.username and activemq.password values with the correct values. in my case, I am going to use the admin account, discussed in the previous step
activemq.username=admin activemq.password=c0mp!ex@01
Step5
Restart your ActiveMQ server
[email protected]:/apps/activemq/apache-activemq-5.15.3/bin$ ./activemq restart INFO: Loading '/apps/activemq/apache-activemq-5.15.3//bin/env' INFO: Using java '/usr/bin/java' INFO: Loading '/apps/activemq/apache-activemq-5.15.3//bin/env' ...... ...... INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/apps/activemq/apache-activemq-5.15.3//data/activemq.pid' (pid '5080') INFO: Loading '/apps/activemq/apache-activemq-5.15.3//bin/env' INFO: Using java '/usr/bin/java' ActiveMQ is running (pid '5080')
Tada!. Now go back to your web console and try to browse the Queue/Topic and you should be OK
Hope this helps.
Cheers,
A K S A R A V
Write to us at [email protected]
Follow us on Facebook | Twitter
To Join our Community in Whatsapp – Click here