Link to home
Start Free TrialLog in
Avatar of cdemir
cdemir

asked on

MQJE036: Queue manager rejected connection attempt

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");                            
   }
 }
//------------------------------------------------------------------

SOLUTION
Avatar of Peter Kwan
Peter Kwan
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cdemir
cdemir

ASKER

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.
Avatar of cdemir

ASKER

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++;
}
//-----------------------------------------------------------------------------------------
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Btw. your code shouldn't even get to the 'new MQQueueManager' line: the variable QueueManager is null.
Avatar of cdemir

ASKER

>>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
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?
Avatar of cdemir

ASKER

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.
That's good new. You should post a message in the Community Support section to get your points refunded.