We help IT Professionals succeed at work.

MQJE036: Queue manager rejected connection attempt

11,940 Views
Last Modified: 2013-12-11
hi,

We are trying to use more than one QueueManager. we can read mq data from "test1" successfully, but when trying to set QMNG "test2", we are getting "MQJE036: Queue manager rejected connection attempt" error.

p.s : when executing this code for one QueueManager, we don't have any problem.

//Main Class :
//------------------------------------------------------------------

String[] QueueManager = null;
QueueManager[1]= "test1";
QueueManager[2]= "test2";
cnt = 3;
k = 1;
while (k < cnt)
{
                   MQQueueManager   QMNG      = null  ;
                   MQRead _MQRead = new MQRead();
                   QMNG = new MQQueueManager(QueueManager[k]);
                   _MQRead.setQMgr(QMNG);
                   _MQRead.Read();
                   _MQRead.finalize();
    System.gc();    
            k++;
}


//MQRead finalize method :
//------------------------------------------------------------------
public void finalize(){                          
   try {
       if (conn != null)   conn.close();
       queue.close();
       QMNG.disconnect();
   } catch (Exception e) {
       logging("MQRead.finalize:"+e.getMessage(),"E");                            
   }
 }
//------------------------------------------------------------------

Comment
Watch Question

Peter KwanAnalyst Programmer
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
1. Can you please post what is your error reason code for MQJE036 error?
MQJE001: An MQException occurred: Completion Code 2, Reason 2058

2. Can you connect to "test2" successfully without connecting to "test1"?
yes. when we try for one "QueueManager", we always connect.

3. Will the exception also be thrown if the sequence is reversed?
yes.

Author

Commented:
hi peter,
when we try this code, we cannot set "test2" to QMNG. so, we can connect "test1" but not "test2". and we get this error : "MQJE001: An MQException occurred: Completion Code 2, Reason 2058".

//-----------------------------------------------------------------------------------------
String[] QueueManager = null;
QueueManager[1]= "test1";
QueueManager[2]= "test2";
cnt = 3;
k = 1;
while (k < cnt)
{
                   MQQueueManager   QMNG      = null  ;
                   QMNG = new MQQueueManager(QueueManager[k]);
    System.gc();    
            k++;
}
//-----------------------------------------------------------------------------------------
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
Btw. your code shouldn't even get to the 'new MQQueueManager' line: the variable QueueManager is null.

Author

Commented:
>>Can you post the output from dspmq (on Windows run it in cmd, on Unix it's under /usr/mqm/bin or /opt/mqm/bin).
Q's status is running. (all of them)

>>I suspect that the second qm doesn't exist.
second qm exist. as i mentinoed above, "when executing this code for one QueueManager, we don't have any problem". btw, when we execute this code on Windows (QMs are created the Unix box), we can connect all QMs and we don't have any problem. but, when running this code on Unix box; for one QM, no problem but for second QM it gives error.

>>Are you doing anything with MQEnvironment before creating the MQQueueManager objects?
No.


may be it can help you more :

MQJE001: An MQException occurred: Completion Code 2, Reason 2058
MQJE036: Queue manager rejected connection attempt
com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2058
MQJE036: Queue manager rejected connection attempt
         at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:242)
         at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:276)
         at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:296)
         at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
         at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:171)
         at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:754)
         at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:688)
         at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:417)
         at MyMqPck.MQRead.selectQMgr(MQRead.java:214)
         at MyMqPck.MqMain.main(MqMain.java:103)
Caused by: com.ibm.mqservices.MQInternalException: MQJE001: An MQException occurred: Completion Code 2, Reason 2058
MQJE036: Queue manager rejected connection attempt
         at com.ibm.mq.MQInternalCommunications.connectToQueueManager(MQInternalCommunications.java:2613)
         at com.ibm.mq.MQInternalCommunications.<init>(MQInternalCommunications.java:569)
         at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1316)
         at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:218)
         ... 9 more

Commented:
To recap:
1. connecting to both qms works when you connect from Windows to Unix
2. when connecting from Unix you cannot connect to the second qm at all

Is that correct?

Are you using bindings mode on Unix?
If so: are you running your program as a user who is a member of the mqm group?

Author

Commented:
hi mglxxx,
yes it is correct but we noticed that MQenvirement settings were wrong and we solved the problem.

mglxxx and pkwan, thanks for your help.

Commented:
That's good new. You should post a message in the Community Support section to get your points refunded.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.