Announcement Announcement Module
Collapse
No announcement yet.
problems with the authentication in ActiveMQ embedded Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problems with the authentication in ActiveMQ embedded

    Hi,

    In one of my tests I have an activemq embedded (5.3.0) configured to force the producer to authenticate in a specific queue before sending the message.

    The configuration is the following:

    <!-- ###################### PRODUCER ##################################### -->
    <jms:outbound-channel-adapter id="adapterToBroker" channel="transformedChannel" connection-factory="connectionFactory"
    destination="broker" />

    <!-- #########################ACTIVE MQ CONFIGURATION ################################### -->
    <amq:broker id="brokerService"
    brokerName="localhost"
    useJmx="false"
    persistent="false"
    start="true"
    advisorySupport="false"
    cacheTempDestinations="false"
    enableStatistics="false"
    useLocalHostBrokerName="true"
    useMirroredQueues="false">

    <amqlugins>

    <!-- #################### AUTHENTICATION ################################## -->
    <amq:simpleAuthenticationPlugin>
    <amq:users>
    <amq:authenticationUser username="system" password="password" groups="users,admins"/>
    <amq:authenticationUser username="user" password="password" groups="users"/>
    </amq:users>
    </amq:simpleAuthenticationPlugin>

    <!-- #################### AUTHORIZATION ################################## -->
    <amq:authorizationPlugin>
    <amq:map>
    <amq:authorizationMap>
    <amq:authorizationEntries>
    <amq:authorizationEntry queue="broker" write="users" read="users" admin="admins" />
    </amq:authorizationEntries>

    <!--<amq:tempDestinationAuthorizationEntry>
    <amq:tempDestinationAuthorizationEntry write="tempDestinationAdmins" read="tempDestinationAdmins" admin="tempDestinationAdmins"/>
    </amq:tempDestinationAuthorizationEntry>-->
    </amq:authorizationMap>
    </amq:map>
    </amq:authorizationPlugin>

    </amqlugins>

    <amq:transportConnectors>
    <amq:transportConnector uri="vm://localhost" />
    </amq:transportConnectors>
    </amq:broker>

    <!-- ActiveMQ destinations to use -->
    <amq:queue id="broker" />

    <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
    <amq:connectionFactory id="connectionFactory" brokerURL="vm://localhost" userName="system" password="password" />


    <!-- ###################### CONSUMER##################################### -->
    <jms:message-driven-channel-adapter channel="testChannel"
    connection-factory="connectionFactory"
    destination="broker"/>



    when I execute my unit test I have the next exception:


    org.springframework.integration.MessageHandlingExc eption: error occurred in message handler [org.springframework.integration.jms.JmsSendingMess ageHandler#0]
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:84)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.dispatch(UnicastingDispatcher.java:9 7)
    at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:44)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.handler.MessageHan dlerChain$ReplyForwardingMessageChannel.send(Messa geHandlerChain.java:179)
    at org.springframework.integration.handler.MessageHan dlerChain$ReplyForwardingMessageChannel.send(Messa geHandlerChain.java:172)
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemp late.send(MessagingTemplate.java:149)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendMessage(AbstractRep lyProducingMessageHandler.java:176)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:160)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.produceReply(AbstractRe plyProducingMessageHandler.java:125)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleResult(AbstractRe plyProducingMessageHandler.java:119)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:101)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
    at org.springframework.integration.handler.MessageHan dlerChain$1.send(MessageHandlerChain.java:150)
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemp late.send(MessagingTemplate.java:149)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendMessage(AbstractRep lyProducingMessageHandler.java:176)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:160)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.produceReply(AbstractRe plyProducingMessageHandler.java:125)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleResult(AbstractRe plyProducingMessageHandler.java:119)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:101)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
    at org.springframework.integration.handler.MessageHan dlerChain.handleMessageInternal(MessageHandlerChai n.java:133)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:78)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.invokeHandler(BroadcastingDispatch er.java:105)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher.access$000(BroadcastingDispatcher. java:41)
    at org.springframework.integration.dispatcher.Broadca stingDispatcher$1.run(BroadcastingDispatcher.java: 90)
    at org.springframework.integration.util.ErrorHandling TaskExecutor$1.run(ErrorHandlingTaskExecutor.java: 52)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.SecurityException: User system is not authorized to read from: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic
    at org.apache.activemq.security.AuthorizationBroker.a ddConsumer(AuthorizationBroker.java:116)
    at org.apache.activemq.broker.MutableBrokerFilter.add Consumer(MutableBrokerFilter.java:93)
    at org.apache.activemq.broker.TransportConnection.pro cessAddConsumer(TransportConnection.java:533)
    at org.apache.activemq.command.ConsumerInfo.visit(Con sumerInfo.java:349)
    at org.apache.activemq.broker.TransportConnection.ser vice(TransportConnection.java:300)
    at org.apache.activemq.broker.TransportConnection$1.o nCommand(TransportConnection.java:178)
    at org.apache.activemq.transport.ResponseCorrelator.o nCommand(ResponseCorrelator.java:116)
    at org.apache.activemq.transport.TransportFilter.onCo mmand(TransportFilter.java:68)
    at org.apache.activemq.transport.vm.VMTransport.itera te(VMTransport.java:210)
    at org.apache.activemq.thread.PooledTaskRunner.runTas k(PooledTaskRunner.java:122)
    at org.apache.activemq.thread.PooledTaskRunner$1.run( PooledTaskRunner.java:43)
    ... 3 more


    Please could you help me? I would appreciate it.
Working...
X