javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

View: New views
6 Messages — Rating Filter:   Alert me  

javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by david sebag :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have this error when trying to receive a message from a queue inside a J2EE container by a rar connection :

Queue 'testqueue2' is not local! Can't create a XAConsumer on it!


I have a swiftmq router 7.5.3.
My J2EE container is JONAS 4.8.3.
I deploy a swiftmq rar in jonas autoload dir with rar.xml and jonas-ra.xml in attachment.

My client code is in a Session Bean service and is very simple :

Context ctx = new InitialContext();
ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("jms/default/ConnectionFactory");
Destination queue = (Destination) ctx.lookup("jms/default/testqueue2");
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = session.createConsumer(queue);
connection.start();
Message message = consumer.receive(100);
session.commit();


When createConsumer method is called, I a this exception :

Caused by: javax.jms.InvalidDestinationException: Queue 'testqueue2' is not local! Can't create a XAConsumer on it!
        at com.swiftmq.tools.requestreply.ReplyNE.createException(Unknown Source)
        at com.swiftmq.tools.requestreply.ReplyNE.readContent(Unknown Source)
        at com.swiftmq.jms.smqp.v750.CreateConsumerReply.readContent(Unknown Source)
        at com.swiftmq.tools.dump.Dumpalizer.construct(Unknown Source)
        at com.swiftmq.jms.v750.ConnectionImpl.dataAvailable(Unknown Source)
        at com.swiftmq.net.client.BlockingConnection.chunkCompleted(Unknown Source)
        at com.swiftmq.net.protocol.smqp.SMQPInputHandler.setBytesWritten(Unknown Source)
        at com.swiftmq.net.protocol.smqp.SMQPInputHandler.setBytesWritten(Unknown Source)
        at com.swiftmq.net.client.BlockingConnection.run(Unknown Source)

Thanks for your help.


ra.xmljonas-ra.xml



Re: javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by IIT Software :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is testqueue2 defined on your local router or not? The exception states it is not...

Re: javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by david sebag :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How can I state the router is local ?

In attachment, the routerconffig of the router.

routerconfig.xml

Re: javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by IIT Software :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That looks fine. Did you configure your Jonas javax.jms.queue (that one which is returned on your JNDI lookup) with the proper queue name? It must be fully qualified: testqueue2@router1. I do not mean the JNDI name but the queue name property.

Re: javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by IIT Software :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

These entries must contain the fully qualified queue names such as:

      <jonas-config-property-name>QueueName</jonas-config-property-name>
      <jonas-config-property-value>testqueue2@router1</jonas-config-property-value>

You must do that for all queues you have defined in jonas-ra.xml.

Re: javax.jms.InvalidDestinationException: Queue is not local! Can't create a XAConsumer on it!

by david sebag :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It works !
Thanks a lot.

I made the change :

  <jonas-adminobject>
    <id>testqueue2</id>
    <description>com.swiftmq.jms.QueueImpl</description>
    <jndi-name>jms/default/testqueue2</jndi-name>
    <jonas-config-property>
      <jonas-config-property-name>QueueName</jonas-config-property-name>
      <jonas-config-property-value>testqueue2</jonas-config-property-value>
    </jonas-config-property>
  </jonas-adminobject>

to

  <jonas-adminobject>
    <id>testqueue2</id>
    <description>com.swiftmq.jms.QueueImpl</description>
    <jndi-name>jms/default/testqueue2</jndi-name>
    <jonas-config-property>
      <jonas-config-property-name>QueueName</jonas-config-property-name>
      <jonas-config-property-value>testqueue2@router1</jonas-config-property-value>
    </jonas-config-property>
  </jonas-adminobject>

in jonas-ra.xml as you suggest.