Hi, I am using Jboss and have configured JAAS authentication. When I try to create a Receiver for the temporary queue I am getting follwoing exception:
javax.jms.JMSSecurityException: Connection not authorized to subscribe to destination: JMS_TQ8
try { Context jndiContext = getInitialContext(); QueueConnectionFactory ref = (QueueConnectionFactory)jndiContext.lookup("ConnectionFactory"); Queue queue = (Queue)jndiContext.lookup("queue/testQueue"); queueConnection = ref.createQueueConnection(); QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); // The temporary queue, TemporaryQueue tq = queueSession.createTemporaryQueue(); queueSender = queueSession.createSender(queue); QueueReceiver qr = queueSession.createReceiver(tq); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); }