Olá, ao configurar o usuário e senha do ActiveMQ e as devidas permissões, não consigo enviar e nem consumir mensagens de uma fila ou tópico.
Seguem as configurações:
arquivo activemq.xml
<plugins>
<simpleAuthenticationPlugin anonymousAccessAllowed="false">
<users>
<authenticationUser username="admin" password="senha" groups="users,admins"/>
<authenticationUser username="guilherme" password="12345" groups="users"/>
<authenticationUser username="guest" password="senha" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry queue="financeiro" read="users" write="users" admin="users"/>
<authorizationEntry topic="loja" read="users" write="users" admin="users"/>
<authorizationEntry topic="ActiveMQ.Advisory.>" read="users,admins" write="users,admins" admin="users,admins"/>
</authorizationEntries>
<tempDestinationAuthorizationEntry>
<tempDestinationAuthorizationEntry read="admin" write="admin" admin="admin"/>
</tempDestinationAuthorizationEntry>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
criando a conexão jms:
Connection connection = factory.createConnection("guilherme", "12345");
Erro exibido no console:
Caused by: java.lang.SecurityException: User guilherme is not authorized to write to: queue://fila.financeiro at org.apache.activemq.security.AuthorizationBroker.addProducer(AuthorizationBroker.java:199) at org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:109) at org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:644) at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:108) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:330) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:194) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:125) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:301) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215) at java.lang.Thread.run(Thread.java:748)