websphere mq Java编程出现这样的问题怎么解决
try {
String qManager="qm2";//队列管理器
String qName="ql_qm2";//本地队列
MQEnvironment.hostname="192.168.1.221";
MQEnvironment.port=1412;
MQEnvironment.channel="serconn";
MQEnvironment.CCSID=1383;
System.out.println(qManager);
MQQueueManager qmgr=new MQQueueManager(qManager);
int openoptions=MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUT;
System.out.println(qName);
MQQueue queue=qmgr.accessQueue(qName, openoptions);
MQMessage msg=new MQMessage();
msg.writeUTF("hello world");
MQPutMessageOptions pmo=new MQPutMessageOptions();
System.out.println("发送消息");
queue.put(msg,pmo);
MQMessage rcvmsg=new MQMessage();
MQGetMessageOptions gmo=new MQGetMessageOptions();
queue.get(rcvmsg,gmo);
String str=rcvmsg.readUTF();
System.out.println(str);
} catch (MQException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MQJE001: MQException 出现:完成代码是 2,原因为 2195
MQJE007: 读取消息数据时出现 IO 错误
MQJE001: MQException 出现:完成代码是 2,原因为 2009
MQJE003: 传输消息缓冲区时出现 IO 错误
MQJE001: MQException 出现:完成代码是 2,原因为 2195
MQJE018: 协议错误 - 接收到意外的段类型
MQJE001: MQException 出现:完成代码是 2,原因为 2195
MQJE018: 协议错误 - 接收到意外的段类型
com.ibm.mq.MQException: MQJE001: MQException 出现:完成代码是 2,原因为 2195
MQJE018: 协议错误 - 接收到意外的段类型
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:212)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:451)
at com.oy.mqtest.MqGetConnection.main(MqGetConnection.java:25)
Caused by: com.ibm.mqservices.MQInternalException: MQJE001: MQException 出现:完成代码是 2,原因为 2195
MQJE018: 协议错误 - 接收到意外的段类型
at com.ibm.mq.MQv6InternalCommunications.establishChannel(MQv6InternalCommunications.java:679)
at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunications.java:206)
at com.ibm.mq.MQv6InternalCommunications.<init>(MQv6InternalCommunications.java:102)
at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)
at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1246)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:184)
... 10 more
--------------------编程问答-------------------- 字符集的问题! --------------------编程问答-------------------- why CCSID using 1383?
which OS you use? if windows you can try using 1381.
补充:企业软件 , WebSphere