MQException 2046 error when getting messages from MQ queue

3.8k Views Asked by At

I am trying to get the messages from one local queue. I have initialized the queue manager , local queue from which I am supposed to fetch the messages .

Open Input options used for local queue

int openInputOptions = MQC.MQOO_OUTPUT ;               
 MQQueue outputQueue=queueManager.accessQueue(remoteQueue, openInputOptions);

and get message options is

MQGetMessageOptions gmo=new MQGetMessageOptions();
gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
gmo.matchOptions=MQC.MQMO_NONE;

When I execute this I am getting

com.ibm.mq.MQException: Completion Code 2, Reason 2036 error .

Which states MQRC_NOT_OPEN_FOR_BROWSE

So I tried to use the below open option ,

int openInputOptions = MQC.MQOO_OUTPUT | MQC.MQOO_BROWSE;

When I try with this , it gives me error code Completion code 2, Reason 2046 error .

1

There are 1 best solutions below

0
On

Is the queue actually local to the queue manager or are you trying to open a 'Remote Queue'. Because if it was a 'Local Queue' then the 'MQC.MQOO_BROWSE' option would work.