|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
  |
|
why error?? |
View previous topic :: View next topic |
Author |
Message
|
jack_booth |
Posted: Sun Feb 11, 2007 10:32 pm Post subject: why error?? |
|
|
Newbie
Joined: 07 Feb 2007 Posts: 2
|
package demo;
import com.ibm.mq.*;
public class Requester {
public static void main(String args[]){
try
{
String hostName ="192.168.1.95";// "ITSOG";
String channel ="BBBB"; // "JAVA.CLIENT.CHNL";
String qManager = "QM_ORANGE"; // "ITSOG.QMGR1";
String requestQueue ="Q3" ; //"SAMPLE.REQUEST";
String replyToQueue = "Q2"; //"//SAMPLE.REPLY";
String replyToQueueManager = "QM_ORANGE"; //"ITSOG.QMGR1";
int iPort=1515;
MQEnvironment.CCSID = 1381;
// Set up the MQEnvironment properties for Client Connections£¨½¨Á¢MQEnvironment ÊôÐÔÒÔ±ã¿Í»§»úÁ¬½Ó£©
MQEnvironment.hostname = hostName;
MQEnvironment.channel = channel;
MQEnvironment.port = iPort;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
MQC.TRANSPORT_MQSERIES);
// Connection To the Queue Manager£¨Á¬½Óµ½¶ÓÁйÜÀíÆ÷£©
MQQueueManager qMgr = new MQQueueManager(qManager);
/* Set up the open options to open the queue for out put and
additionally we have set the option to fail if the queue manager is
quiescing. £¨½¨Á¢´ò¿ªÑ¡ÏîÒÔ±ã´ò¿ªÓÃÓÚÊä³öµÄ¶ÓÁУ¬½øÒ»²½¶øÑÔ£¬Èç¹û¶ÓÁйÜÀíÆ÷ÊÇÍ£¶ÙµÄ»°£¬ÎÒÃÇÒ²
ÒÑÉèÖÃÁËÑ¡ÏîÈ¥Ó¦¶Ô²»³É¹¦Çé¿ö¡££©
*/
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
// Open the queue£¨´ò¿ª¶ÓÁУ©
MQQueue queue = qMgr.accessQueue(requestQueue,
openOptions,
null,
null,
null);
// Set the put message options , we will use the default setting.£¨ÉèÖ÷ÅÖÃÏûϢѡÏÎÒÃǽ«Ê¹ÓÃĬÈÏÉèÖã©
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = pmo.options + MQC.MQPMO_NEW_MSG_ID;
pmo.options = pmo.options + MQC.MQPMO_SYNCPOINT;
// pmo.options=+MQC.MQSEG_INHIBITED;
MQMessage outMsg = new MQMessage(); //Create the message buffer£¨´´½¨ÏûÏ¢»º³åÇø£©
outMsg.format = MQC.MQFMT_STRING; // Set the MQMD format field.£¨ÉèÖÃMQMD ¸ñʽ×ֶΣ©
outMsg.messageFlags = MQC.MQMT_REQUEST;
outMsg.replyToQueueName = replyToQueue;
outMsg.replyToQueueManagerName = replyToQueueManager;
// outMsg.correlationId=correlationID;
// Prepare message with user data£¨×¼±¸Óû§Êý¾ÝÏûÏ¢£©
String msgString = "Test Request Message from Requester program ";
outMsg.writeString(msgString);
// Now we put The message on the Queue£¨ÏÖÔÚÎÒÃÇÔÚ¶ÓÁÐÉÏ·ÅÖÃÏûÏ¢£©
queue.put(outMsg, pmo);
// Commit the transaction.£¨Ö´ÐиÃÊÂÎñ´¦Àí£©
qMgr.commit();
System.out.println(" The message has been Sussesfully put\n\n#########");
// Close the the Request Queue£¨¹Ø±ÕÇëÇó¶ÓÁУ©
queue.close();
// Set openOption for response queue£¨ÉèÖôò¿ªÑ¡ÏîÒÔ±ã¶ÓÁÐÏìÓ¦£©
openOptions = MQC.MQOO_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING;
MQQueue respQueue = qMgr.accessQueue(replyToQueue,
openOptions,
null,
null,
null);
MQMessage respMessage = new MQMessage();
System.out.println("×ßµ½Õâ²½ÁË!!");
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = gmo.options + MQC.MQGMO_SYNCPOINT;//Get messages under syncpoint control(ÔÚͬ²½µã¿ØÖÆÏ»ñÈ¡ÏûÏ¢)
gmo.options = gmo.options + MQC.MQGMO_WAIT; // Wait for Response Message£¨µÈ´ýÏìÓ¦ÏûÏ¢£©
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
// gmo.options=+MQC.MQSEG_INHIBITED;
gmo.waitInterval = 1000;
System.out.println("correlationId :"+outMsg.messageId.length);
respMessage.correlationId = outMsg.messageId;
// Get the response message.£¨»ñÈ¡ÏìÓ¦ÏûÏ¢£©
respQueue.get(respMessage, gmo);
String response = respMessage.readString(respMessage.getMessageLength());
System.out.println("The response message is : " + response);
qMgr.commit();
respQueue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQ Error Occurred: Completion Code is :\t" +
ex.completionCode + "\n\n The Reason Code is :\t" + ex.reasonCode );
ex.printStackTrace();
}
catch(Exception e) {
e.printStackTrace();
}
}
}
error:
MQJE001: 2£¬ 2033
An MQ Error Occurred: Completion Code is : 2
The Reason Code is : 2033
com.ibm.mq.MQException: MQJE001: 2033
at com.ibm.mq.MQQueue.get(MQQueue.java:1033)
at demo.Requester.main(Requester.java:84) |
|
Back to top |
|
 |
mansoor |
Posted: Sun Feb 11, 2007 11:17 pm Post subject: |
|
|
 Novice
Joined: 24 Sep 2003 Posts: 13 Location: Saudi Arabia
|
Put message on queue 'Q3' and run the program |
|
Back to top |
|
 |
jack_booth |
Posted: Mon Feb 12, 2007 6:59 am Post subject: error, |
|
|
Newbie
Joined: 07 Feb 2007 Posts: 2
|
The message has been Sussesfully put
#########
correlationId :24
MQJE001: 2C 2033
An MQ Error Occurred: Completion Code is : 2
The Reason Code is : 2033
com.ibm.mq.MQException: MQJE001: 2C 2033
at com.ibm.mq.MQQueue.get(MQQueue.java:1033)
at demo.Requester.main(Requester.java:84) |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 12, 2007 7:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
That is a normal thing.
It means that there are no messages on the queue that match what you have asked for.
Many new MQ developers run into issues trying to read more than one message off of the queue because they do not reset the MessageId and CorrelationId on the MQMD before performing the next Get.
This causes MQ to try to match the msgid and correlid of the message that it had already read. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
  |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|