Home > OS >  MQJE001: MQException: complete code is 2, the reason for 2058
MQJE001: MQException: complete code is 2, the reason for 2058

Time:09-29

Just began to learn the WebSphere MQ, installed after the client according to the tutorial has established the queue manager, queue, channel using Java code to achieve sendMessage and getMessage, error when the send
Com. IBM. Mq. MQException: MQJE001: MQException: complete code is 2, the reason of 2058
MQJE036: queue manager rejected the connection attempt
At com. IBM. Mq. MQManagedConnectionJ11. & lt; init> (MQManagedConnectionJ11. Java: 212)
At com. IBM. Mq. MQClientManagedConnectionFactoryJ11. _createManagedConnection (MQClientManagedConnectionFactoryJ11. Java: 318)
At com. IBM. Mq. MQClientManagedConnectionFactoryJ11. CreateManagedConnection (MQClientManagedConnectionFactoryJ11. Java: 338)
At com. IBM. Mq. StoredManagedConnection. & lt; init> (StoredManagedConnection. Java: 84)
At com. IBM. Mq. MQSimpleConnectionManager. AllocateConnection (MQSimpleConnectionManager. Java: 168)
At com. IBM. Mq. MQQueueManagerFactory. ObtainBaseMQQueueManager (MQQueueManagerFactory. Java: 772)
At com. IBM. Mq. MQQueueManagerFactory. Procure (MQQueueManagerFactory. Java: 697)
At com. IBM. Mq. MQQueueManagerFactory. ConstructQueueManager (MQQueueManagerFactory. Java: 657)
At com. IBM. Mq. MQQueueManagerFactory. CreateQueueManager (MQQueueManagerFactory. Java: 153)
At com. IBM. Mq. MQQueueManager. & lt; init> (MQQueueManager. Java: 451)
At com. Cn. BNPP. SSW. MessageByMQ. SendMessage (MessageByMQ. Java: 102)
At com. Cn. BNPP. SSW. MessageByMQ. Main (182) MessageByMQ. Java:
Under Caused by: com. IBM. Mqservices. MQInternalException: MQJE001: MQException: complete code is 2, the reason of 2058
MQJE036: queue manager rejected the connection attempt
At com. IBM. Mq. MQv6InternalCommunications. ParseConnReply (MQv6InternalCommunications. Java: 1757)
At com. IBM. Mq. MQv6InternalCommunications. ConnectToQueueManager (MQv6InternalCommunications. Java: 1695)
At com. IBM. Mq. MQv6InternalCommunications. The initialize (MQv6InternalCommunications. Java: 278)
At com. IBM. Mq. MQv6InternalCommunications. & lt; init> (MQv6InternalCommunications. Java: 102)
At com. IBM. Mq. MQSESSIONClient. MQCONNX (MQSESSIONClient. Java: 1337)
At com. IBM. Mq. MQSESSIONClient. MQCONN (MQSESSIONClient. Java: 1246)
At com. IBM. Mq. MQManagedConnectionJ11. & lt; init> (MQManagedConnectionJ11. Java: 184)
. 11 more
The Exception in the thread "main" Java. Lang. NullPointerException
At com. Cn. BNPP. SSW. MessageByMQ. SendMessage (MessageByMQ. Java: 125)
At com. Cn. BNPP. SSW. MessageByMQ. Main (182) MessageByMQ. Java:

CodePudding user response:

With the following code can be successful to the project before the send and getmessage existing Q in the queue, but my own new queue not
Public static int sendMessage (String qName, String message) {
Int result=0;
Try {
//set the connection queue attributes of the
//Note. The MQC interface defines all The constants, informs by The WebSphere MQ Java programming interface
//(except for the completion code constants and the error code constants).
//MQOO_INPUT_AS_Q_DEF: Open the queue to get the messages using the queue - defined default.
//MQOO_OUTPUT: Open the queue to put messages.
/* target for remote queue, all here can not use MQOO_INPUT_AS_Q_DEF attributes */
//int openOptions=MQC. MQOO_INPUT_AS_Q_DEF | MQC. MQOO_OUTPUT;
/* the following options can be suitable for the remote queue with local queue */
Int openOptions=MQC. MQOO_OUTPUT | MQC. MQOO_FAIL_IF_QUIESCING;
//connection queue
//MQQueue provides the inquire, the set, the put and get operations for WebSphere MQ the queues.
//The The inquire and set "capabilities are inherited from MQManagedObject.
/* closed will re-open */
If (qMgr==null | |! QMgr. IsConnected ()) {
QMgr=new MQQueueManager (qmName);
}
MQQueue queue=qMgr. AccessQueue (qName, openOptions);
//define a simple message
MQMessage putMessage=new MQMessage ();
//the data into a message buffer
PutMessage. WriteUTF (message);
//set in the properties of the message (default property)
MQPutMessageOptions pmo=new MQPutMessageOptions ();
//the message is written to the queue
The queue. The put (putMessage, pmo);
The queue. The close ();
System. The out. Println (" sendMessage Done ");
{} the catch (MQException ex)
System. Out.println (" A WebSphere MQ error occurred: the Completion code "
+ ex.com pletionCode + "is" Reason code "+ ex. ReasonCode);
ex.printStackTrace();
{} the catch (IOException ex)
System. The out. Println (" An error occurred whilst writing to the message buffer: "+ ex);
{} the catch (Exception ex)
ex.printStackTrace();
} the finally {
Try {
QMgr. Disconnect ();
} the catch (MQException e) {
e.printStackTrace();
}
}
return result;
}

CodePudding user response:

In his original program, there are two queues, one of them can be normal use this code, another not, is 2058

CodePudding user response:

I also met the same problem, could you tell me the problem you solved? To enlighten me

CodePudding user response:

I also met the same problem, I use two queue managers, each queue manager to set up a local queue, a remote queue, queue manager using the default channel between monitored start is a port, a command line runmqsc can save message, message, connection, is the code to 2058 error, a
  • Related