【发布时间】:2018-06-15 00:33:12
【问题描述】:
在 IBM-MQ 上启动异步侦听器/读取器时出现 MQJCA1025 错误 -
com.ibm.msg.client.jms.DetailedIllegalStateException:MQJCA1025: 消息使用者不能有消息侦听器。一个应用程序 试图为 JMS 消息使用者设置消息侦听器。这 仅当应用程序在托管环境中运行时才会发生异常 环境。修改应用程序,使其使用消息 听众。
下面是完成监听器设置的init方法 -
public void init(){
ConnectionFactory qConnectionFactory = null;
Connection connection = null;
try{
Context ctx = new InitialContext();
qConnectionFactory = (ConnectionFactory) ctx.lookup("java:jboss/Connection");
Destination receiverQueue = null;
if(null != qConnectionFactory){
connection = qConnectionFactory.createConnection();
if(null !=connection){
receiverQueue = (Destination) ctx.lookup("java:jboss/RESPONSE");
if(null != receiverQueue){
Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
if(null != session){
MessageConsumer consumer = session.createConsumer(receiverQueue);
consumer.setMessageListener(this);
connection.start();
}
}
}
}
}
catch(Exception e){
System.out.println(e);
}
}
http://www-01.ibm.com/support/docview.wss?uid=swg21610734 的 IBM 决议未提及要在侦听器/客户端进行的修复
【问题讨论】: