14 Replies Latest reply on Jul 10, 2013 5:31 AM by Prashant S

    JMS Queue already exists error

    Prashant S Newbie

      I get the following error while using hornetq 2.3:

       

      00:42:28,435 ERROR [org.hornetq.core.server] HQ224016: Caught exception: HornetQException[errorType=QUEUE_EXISTS message=HQ119019: Queue already exists jms.queue.MyQueue]

              at org.hornetq.core.server.impl.HornetQServerImpl.createQueue(HornetQServerImpl.java:1811) [hornetq-server.jar:]

              at org.hornetq.core.server.impl.HornetQServerImpl.createQueue(HornetQServerImpl.java:1107) [hornetq-server.jar:]

              at org.hornetq.core.server.impl.ServerSessionImpl.createQueue(ServerSessionImpl.java:427) [hornetq-server.jar:]

              at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:235) [hornetq-server.jar:]

              at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:631) [hornetq-core-client.jar:]

              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:547) [hornetq-core-client.jar:]

              at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:523) [hornetq-core-client.jar:]

              at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:564) [hornetq-server.jar:]

              at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:72) [hornetq-core-client.jar:]

              at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88) [netty.jar:]

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560) [netty.jar:]

              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787) [netty.jar:]

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:281) [netty.jar:]

              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-client.jar:]

              at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-client.jar:]

              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty.jar:]

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560) [netty.jar:]

              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555) [netty.jar:]

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty.jar:]

              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty.jar:]

              at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:71) [netty.jar:]

              at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73) [netty.jar:]

              at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51) [netty.jar:]

              at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty.jar:]

              at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty.jar:]

              at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175) [netty.jar:]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]

       

      The error is produced in the following scenario:

      1. Start hornetq server

      2. Start another server having jms receiver for the queue "MyQueue"

           Note: MyQueue is not dynamic queue. It has been configured in hornetq server hornetq-jms.xml:

                     <queue name="MyQueue">

                        <entry name="/queue/cacheDbSaveQueue"/>

                        <durable>false</durable>

                    </queue>

       

                     And I use JNDI to look up the queue while configuring the receiver.

       

      3. Stop and restart hornetq server and I get this error in hornetq server.

      Note: If queue receiver is stopped first before starting hornetq server, no error is thrown.

        • 1. Re: JMS Queue already exists error
          Yong Hao Gao Master

          The stack suggests that you have some client calling createQueue() on session. If you simply use JNDI there shouldn't be such a call.

          • 2. Re: JMS Queue already exists error
            Prashant S Newbie

            The queue in question is not dynamic.

             

            After some analysis, following are the findings:

            1. When the queue is non-durable the exception occurs, if the queue is durable, the exception is not thrown.

            2. Steps to reporduce the exception:

                a) Start hornetq server and start a receiver for the queue.

                b) Stop hornetq server and restart again.

                c) On restart, the exception occurs.

             

            3. The exception occurs in case of Topic also. Following exception is occuring in case of durable subscriber attached to the topic:

             

            23:46:11,596 ERROR [org.hornetq.core.server] HQ224016: Caught exception: HornetQException[errorType=QUEUE_DOES_NOT_EXIST message=HQ119017

            at org.hornetq.core.server.impl.ServerSessionImpl.createConsumer(ServerSessionImpl.java:348) [hornetq-server.jar:]

            at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:218) [hornetq-server.jar:]

            at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:631) [hornetq-core-client.jar:]

            at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:547) [hornetq-core-client.jar:]

            at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:523) [hornetq-core-client.jar:]

            at org.hornetq.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:564) [hornetq-server.jar:]

            at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:72) [hornetq-core-client.jar:]

            at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88) [netty.jar:]

            at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560) [netty.jar:]

            at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787) [netty.jar:]

            at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:281) [netty.jar:]

            at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169) [hornetq-core-client.jar:]

            at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134) [hornetq-core-client.jar:]

            at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty.jar:]

            at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560) [netty.jar:]

            at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:555) [netty.jar:]

            at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty.jar:]

            at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty.jar:]

            at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:71) [netty.jar:]

            at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73) [netty.jar:]

            at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:51) [netty.jar:]

            at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) [netty.jar:]

            at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty.jar:]

            at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:175) [netty.jar:]

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_01]

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_01]

            at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_01]

            • 3. Re: JMS Queue already exists error
              Andy Taylor Master

              what are you doing in your code?

              • 4. Re: JMS Queue already exists error
                Prashant S Newbie

                Using hornetq 2.3.0 final non-clustered standalone server.

                Attached producer, receiver and hornetq-jms.xml for a test queue. Please configure the jndi provider url accordingly.

                The exception can be easily reproduced on queue:

                    a) Start hornetq server and start a receiver for the queue.

                    b) Stop hornetq server and restart again.

                    c) On restart, the exception occurs in hornetq server logs.

                 

                Although in case of topic and durable subscriber, it is not reproducible. Perhaps there is some boundary case in which the error occurs for topic.

                • 5. Re: JMS Queue already exists error
                  Andy Taylor Master

                  ok, does this happen when the queue is durable, to survive a restart and allow failover it should be set to true, maybe this is a side issue of this?

                  • 6. Re: JMS Queue already exists error
                    Prashant S Newbie

                    This happens when the queue is non durable. If the queue is durable, no exception occurs.

                    • 7. Re: JMS Queue already exists error
                      Andy Taylor Master

                      like i said, to survive a restart the queue needs to be durable, this is probably a side effect of the client failing over, set durable to true

                      • 8. Re: JMS Queue already exists error
                        Prashant S Newbie

                        The other exception I received for durable topic subscriber is slightly different.

                        The exception is:

                         

                        23:46:11,596 ERROR [org.hornetq.core.server] HQ224016: Caught exception: HornetQException[errorType=QUEUE_DOES_NOT_EXIST message=HQ119017: Queue testTopic-TestTopic does not exist]

                        at org.hornetq.core.server.impl.ServerSessionImpl.createConsumer(ServerSessionImpl.java:348) [hornetq-server.jar:]

                        at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:218) [hornetq-server.jar:]

                        at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:631) [hornetq-core-client.jar:]

                        at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:547) [hornetq-core-client.jar:]

                        at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:523) [hornetq-core-client.jar:

                         

                        I think in this case, the client sends the SessionCreateConsumerMessage, but the jms topic binding is not found in postoffice.

                        What could be the possible reasons for this. Also, will the client reconnect after this.


                        • 9. Re: JMS Queue already exists error
                          Clebert Suconic Master

                          How are you creating the queues?

                          • 10. Re: JMS Queue already exists error
                            Prashant S Newbie

                            Configured the jms topic in hornetq-jms.xml like:

                             

                            <topic name="myTopic">

                                    <entry name="/topic/myTopic"/>

                                </topic>

                             

                            Then used JNDI to look up the topic while configuring the durable subscriber or sender.

                            • 11. Re: JMS Queue already exists error
                              Andy Taylor Master

                              what is your persistence configuration, i.e. is it enabled?

                              • 12. Re: JMS Queue already exists error
                                Prashant S Newbie

                                Yes, the message is persistent: messageProducer.setDeliveryMode(DeliveryMode.PERSISTENT)

                                There are two durable subscribers listening to the topic.


                                • 13. Re: JMS Queue already exists error
                                  Andy Taylor Master

                                  ni imean, do you have it enabled on the journal?

                                  • 14. Re: JMS Queue already exists error
                                    Prashant S Newbie

                                    I did not add any queue/topic configuration related to journal. Used the same configuration as provided in hornetq 2.3.0 distribution standalone server.

                                    Just added the following in hornetq-jms.xml:

                                     

                                    <topic name="myTopic">

                                            <entry name="/topic/myTopic"/>

                                        </topic>

                                     

                                    and added the following in hornetq-configuration.xml:

                                     

                                    <security-setting match="jms.topic.myTopic">

                                                <permission type="createDurableQueue" roles="guest"/>

                                                <permission type="deleteDurableQueue" roles="guest"/>

                                                <permission type="createNonDurableQueue" roles="guest"/>

                                                <permission type="deleteNonDurableQueue" roles="guest"/>

                                                <permission type="consume" roles="guest"/>

                                                <permission type="send" roles="guest"/>

                                            </security-setting>

                                     

                                    <address-setting match="jms.topic.myTopic">

                                                <max-size-bytes>268435456</max-size-bytes>

                                                <address-full-policy>FAIL</address-full-policy>

                                            </address-setting>