|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Java MQ error --help required |
« View previous topic :: View next topic » |
Author |
Message
|
Vishy |
Posted: Thu Sep 11, 2003 8:17 am Post subject: Java MQ error --help required |
|
|
Novice
Joined: 30 Jul 2003 Posts: 21
|
I am trying to read a string and put that on the Q. The class is compiling fine, but I am repeatedly getting the following error. The QManager is defined and even the listener is running. IS it something in the code or related to MQSetup. Thanks in advance
The error is
C:\>javac TestMessage.java
C:\>java TestMessage Hello
Sent Msg= Hello
Unable to load message catalog - mqji
MQException: in QManager,PMO 2059 Message catalog not found
import com.ibm.mq.*;
import java.util.*;
public class TestMessage{
/**
* Insert the method's description here.
* Creation date: (9/8/2003 10:21:55 AM)
* @param args java.lang.String[]
*/
public static void main(String[] args) {
String m_msg = null;
if (args.length < 1) {
System.out.println("Must provide message data parm at least");
return;
}
if (args.length > 0) {
m_msg = args[0];
}
System.out.println("Sent Msg= " + m_msg);
try {
m_msg = sendMessage(m_msg);
//System.out.println("Returned msg= " + m_msg);
return;
} catch (Exception e) {
System.out.println(e);
}
return;
}
public static String sendMessage(String m_msg) throws MQException{
MQQueueManager qMgr = null;
String qManager = "ATHATAQ0";
byte[] message_Id = null;
String msgData = null;
MQQueue system_default_local_queue = null;
try{
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.hostname = "localhost";
MQEnvironment.port = 9050;
// Create a connection to QManager
qMgr = new MQQueueManager(qManager);
// Set up the options on the Q we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the Q that we wish to open and the open options
system_default_local_queue = qMgr.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE", openOptions);
// Define a simple message
MQMessage mqMsg = new MQMessage();
mqMsg.messageType = MQC.MQMT_REQUEST;
mqMsg.format = MQC.MQFMT_STRING;
mqMsg.priority = MQC.MQPRI_PRIORITY_AS_Q_DEF;
mqMsg.expiry = 1200;
// Specify the message options
MQPutMessageOptions mqPMO = new MQPutMessageOptions();
// Put the message on the Q
system_default_local_queue.put(mqMsg,mqPMO);
System.out.println( "The request message was put successfully on the queue");
message_Id = mqMsg.messageId;
}catch(MQException e){
System.out.println("MQException: in QManager,PMO " + e.reasonCode + " " + e.getMessage());
}
try{
// Close the Q
system_default_local_queue.close();
// Disconnect from QueueManager
qMgr.disconnect();
}catch (MQException ex) {
System.out.println("A WebSphere MQ error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode);
} finally {
return msgData;
}
}
} |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 11, 2003 8:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you sure your listener is running on port 9050? |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Sep 12, 2003 3:12 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
The listener is probably running on 1414 (the default) and not 9050. Also, you can get rid of the mqji message catalog error by adding the wmq\java\lib directory to your classpath. |
|
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
|
|
|
|