Java程序MQ 7的连接问题

编程入门 行业动态 更新时间:2024-10-19 20:26:42
本文介绍了Java程序MQ 7的连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想连接到MQ7服务器下面是代码:

I am trying to connect to the MQ7 Server below is the code :

Hashtable props = new Hashtable(); // Change the host name to your host name. Leave it as it is if // queue manager is on the same machine props.put(CMQC.HOST_NAME_PROPERTY, serverConfig.server); props.put(CMQC.PORT_PROPERTY, serverConfig.port); props.put(CMQC.CHANNEL_PROPERTY, serverConfig.sChannel); qMgr = new MQQueueManager(qManager, props); System.out.println("Queue Manager : "+qMgr+" null"); int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE; queue = qMgr.accessQueue(queueName, openOptions); System.out.println("Successfully registered"); //creating msg message = new MQMessage();

它正在连接,但发送一条消息后发生错误

it's getting connected but after sending one message its throwing a error

" MQJE001: Completion Code '1', Reason '2068'. com.ibm.mq.MQException: MQJE001: Completion Code '1', Reason '2068'. strngError: No valid counters. strngError: No valid counters. at com.ibm.mq.MQManagedObject.inquire(MQManagedObject.java:269) at com.ibm.mq.MQManagedObject.getInt(MQManagedObject.java:479) at com.ibm.mq.MQQueue.getCurrentDepth(MQQueue.java:995) at middlewarex.IBMmq.getQueueCount(IBMmq.java:227) at middlewarex.ThreadScenario.run(ThreadScenario.java:94) at java.lang.Thread.run(Thread.java:722)

指向行

" public long getQueueCount() throws Exception{ return queue.getCurrentDepth(); } "

请帮我

推荐答案

您是否在手册中查找原因代码2068?因为如果您这样做,您会看到使用选项MQOO_INQUIRE无效。

Did you look up Reason Code 2068 in the manual? Because if you did, you would have seen that using option MQOO_INQUIRE is invalid.

其次,为什么要打开队列以获取消息?这是一个非常糟糕的做法。你说你正在向一个队列发送消息,因此,你应该打开队列只输出。

Secondly, why are you opening the queue for BOTH putting and getting messages? This is a VERY bad practice. You say you are sending (putting) a message to a queue, therefore, you should be opening the queue for output only.

更多推荐

Java程序MQ 7的连接问题

本文发布于:2023-10-31 04:40:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545036.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   Java   MQ

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!