如何解决问题"com.ibm.mq.MQException:MQJE001:完成代码2,原因2040"; [英] How to clear the issue "com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040"

查看:919
本文介绍了如何解决问题"com.ibm.mq.MQException:MQJE001:完成代码2,原因2040";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码禁止队列,但是当我尝试禁止队列时出现错误.
我已经为特定的队列尝试了各种打开选项,但是仍然有问题.我在代码中还错过了什么?

I have used the below code to inhibit the queue but when I try to inhibit I got the error.
I have tried various open options for the particular queue but still i have the issue. what else i missed in my code;

     public void control(String mgrName, String queueName, int openOptions, string option)throws MQException{
     qMgr = new MQQueueManager(mgrName);
       mqQueue = qMgr.accessQueue(queueName, openOptions);    
       if (option.equalsIgnoreCase("stop")){
            System.out.println("Stop mesage received");
             mqQueue.setInhibitGet(MQC.MQQA_GET_INHIBITED);
             System.out.println("Queue inhibitted successfully");
        }else if(option.equalsIgnoreCase("start")){
            System.out.println("Start mesage received");
            mqQueue.setInhibitGet(MQC.MQQA_GET_ALLOWED);
            System.out.println("Queue get allowed successfully");
        }
}

调用此方法时出现以下错误.
com.ibm.mq.MQException:MQJE001:完成代码2,原因2040

I have got the below Error when call this method.
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2040

推荐答案

2040 = MQRC_NOT_OPEN_FOR_SET. IBM v7.5知识中心页面"

2040 = MQRC_NOT_OPEN_FOR_SET. The IBM v7.5 Knowledge center page "2040 (07F8) (RC2040): MQRC_NOT_OPEN_FOR_SET" describes the reason for this error:

说明

已发出MQSET调用来设置队列属性,但尚未打开队列进行设置.

An MQSET call was issued to set queue attributes, but the queue had not been opened for set.

程序员的回应

在打开对象时指定MQOO_SET.

Specify MQOO_SET when the object is opened.

如果传递给controlopenOptions包含MQOO_SET,则该错误应消失.

If the openOptions passed to control included MQOO_SET then the error should go away.

以下示例:

int openOptions = MQConstants.MQOO_FAIL_IF_QUIESCING | MQConstants.MQOO_SET

这篇关于如何解决问题"com.ibm.mq.MQException:MQJE001:完成代码2,原因2040";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆