如何以编程方式从“mq.sys.dmq”读取消息。我使用 Glassfish 3.1.2.2
当我尝试:
InitialContext ctx = new InitialContext();
Queue queue = (Queue) ctx.lookup("mq.sys.dmq");
QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx.lookup("jms/ConnectionFactory");
QueueConnection queueConn = connFactory.createQueueConnection();
QueueSession queueSession = queueConn.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueReceiver queueReceiver = queueSession.createReceiver(queue);
我收到:
javax.naming.NamingException:查找“mq.sys.dmq”失败