How to use a temporary queue with username and password?
arabin Oct 4, 2003 7:33 PMI have the following problem.
Application A creates a connection using the following call:
InitialContext initCtx = new InitialContext ();
QueueConnectionFactory qfactory = (QueueConnectionFactory) initCtx.lookup(QUEUE_CONNECTION_FACTORY);
QueueConnection qconnection = qfactory.createQueueConnection ();
Application A creates a TemporaryQueue tempQueue and attaches this queue with method JMSsetReplyTo (tempQueue) to the message.
The message is sent to application B.
Application B creates connection using the following code:
InitialContext initCtx = new InitialContext ();
QueueConnectionFactory qfactory = (QueueConnectionFactory) initCtx.lookup(QUEUE_CONNECTION_FACTORY);
QueueConnection qconnection = qfactory.createQueueConnection ();
Then it reads JMSsetReplyTo and sends a message as a reply back to the temporary queue.
Everything is OK and works. The message from B to A is successfully sent back from B to A.
Now the story changes.
Application A uses the call
QueueConnection qconnection = qfactory.createQueueConnection (username,password);
instead of
QueueConnection qconnection = qfactory.createQueueConnection ();
Application B uses the same code (as A), just with different username and password
Now when B send a message back to A, the message is not delivered and I see an exception (JMS_TQ1 was the content of JMSReplyTo) on
the application B (actually, that was a message driven Bean, running under JBoss):
2003-10-04 20:05:14,961 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
javax.jms.JMSSecurityException: Connection not autorized to addMessages to destination: JMS_TQ1
at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:160)
at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:234)
at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:253)
at java.lang.Thread.run(Thread.java:534)
2003-10-04 20:05:14,981 ERROR [STDERR] javax.jms.JMSSecurityException: Connection not autorized to addMessages to destination: JMS_TQ1
2003-10-04 20:05:14,981 ERROR [STDERR] at org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:160)
2003-10-04 20:05:14,981 ERROR [STDERR] at org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:234)
2003-10-04 20:05:14,991 ERROR [STDERR] at org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:137)
2003-10-04 20:05:14,991 ERROR [STDERR] at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:253)
2003-10-04 20:05:14,991 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
When I am using a permanent queue, not a temporary one, everything works OK.
What is the solution for the situation described?