使用客户端模式连接到 IBM MQ 时出现 MQJMS2005 异常
执行以下尝试使用客户端模式连接 WebSphere MQ QueueManager 的代码,出现 MQJMS2005 异常
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
cf.setPort(port);
cf.setHostName(host);
cf.setChannel(channel);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager(queuemanager);
conn = (MQQueueConnection)cf.createQueueConnection();
我使用 com.ibm.mq.jar 、 com.ibm.mqjms.jar、dhbcore.jar、jmscommon.jar和 j2ee.jar。
我认为这可能与权限有关,因为当连接到另一个主机/端口/通道/队列管理器/队列时,相同的代码可以在另一台机器上正常工作
堆栈跟踪如下:
javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'host:queuemanager'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:644)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2591)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1936)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:161)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:206)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:126)
at MQTest.init(MQTest.java:51)
如何解决此问题,以便我可以使代码成功运行?
Executing the below code which attempts to connect WebSphere MQ QueueManager using client mode I got MQJMS2005 exception
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
cf.setPort(port);
cf.setHostName(host);
cf.setChannel(channel);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager(queuemanager);
conn = (MQQueueConnection)cf.createQueueConnection();
I use com.ibm.mq.jar , com.ibm.mqjms.jar, dhbcore.jar, jmscommon.jar and j2ee.jar.
I assume this might be something related to permission, because the same code can work fine on another machine when connecting to another host/port/channel/queue manager/queue
The stack trace is as follows:
javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'host:queuemanager'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:644)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2591)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1936)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:161)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:206)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:126)
at MQTest.init(MQTest.java:51)
How can I troubleshoot this so that I can make run the code sucessfully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我们在 .binding 文件或 DEV-WEST 文件中遇到问题的异常,我们在其中配置 MQ 客户端信息,例如
SSP-FLOW.VERICHECK_HOST_NAME = 113.130.234.174 即
检查所有这些区域,这些区域是由于出现异常而导致的缺陷区域。
This is the exception comming we have issue with .binding file or in the DEV-WEST file , where we are configuring the MQ client information like
SSP-FLOW.VERICHECK_HOST_NAME = 113.130.234.174 i.e
check all these area , these are the flaw area due to which exception if comming .
后来我发现这是由于权限问题。
使用客户端方式连接MQ时,可以对MQ进行允许的客户端ip等权限设置;
在我之前的例子中,机器没有添加到允许列表中;
而另一个运行良好的应用程序实际上使用的是绑定模式而不是客户端模式。
所以它绑定到一个允许的用户 ID。
later I found out that it's due to permission issues.
when connecting to MQ using client mode, the MQ can be configured with permission settings such as allowed client ip;
In my previous case, the machine is not added to the allowed list;
while the other app running fine actually is using bind mode rather than client mode.
so it's bind to one allowed user id.
我遇到了同样的问题。这与 MQ Queuemanager xml 或 Websphere MQ 安装上的通道数或某些设置有关。 这可能会有所帮助。
I came across the same problem. It's to do with no of channels or some setting on MQ Queuemanager xml or Websphere MQ Installation. This might help.