我也曾经遇到过这个错误,当时队列管理器,队列,通道都一一创建,但就是报错
HostName=192.168.8.46
Channel=CH1
QManager=WNMS3_QM
MQJE001: 完成代码为“2”,原因为“2059”。
com.ibm.mq.MQException: MQJE001: 完成代码为“2”,原因为“2059”。
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:229)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:500)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:541)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:95)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:182)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:870)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:756)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:704)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:169)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:594)
at TestSend.main(TestSend.java:32)
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9503: 通道协商失败。 [3=CH1]
at com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.initSess(RemoteConnection.java:1435)
at com.ibm.mq.jmqi.remote.internal.system.RemoteConnection.connect(RemoteConnection.java:991)
at com.ibm.mq.jmqi.remote.internal.system.RemoteConnectionPool.getConnection(RemoteConnectionPool.java:293)
at com.ibm.mq.jmqi.remote.internal.RemoteFAP.jmqiConnect(RemoteFAP.java:1371)
at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:924)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:224)
... 10 more
解决办法:经过我仔细分析,并上一些IBM官方网站查看资料,应该是程序创建队列管理器设置字符集编码问题造成的。
MQEnvironment.CCSID = 1383; //mq服务器安装默认的字符集编码