|
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:15 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. 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
IS it something in the code or related to MQSetup. Thanks
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 |
|
 |
vennela |
Posted: Thu Sep 11, 2003 8:29 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Your code looks fine
What makes you say that your listener is running?
netstat -an
see if something is listening on the port 9050
Also to get rid of the message catalog not found error, put the mqji.properties file in the CLASSPATH. That file should be in the same location where your jar files are
Last edited by vennela on Thu Sep 11, 2003 8:30 am; edited 1 time in total |
|
Back to top |
|
 |
clindsey |
Posted: Thu Sep 11, 2003 8:30 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
It looks like you have a couple of problems. The message catalogs are in the <mq>\java\lib directory. Add this directory to your classpath and your "Message catalog not found" message will go away.
The 2059 means you are failing on the queue manager connect. Make sure your listerner is listening on port 9050 and the name is ATHATAQ0.
The case is important. If the listener is runmqlsr, start it with
runmqlsr -m ATHATAQ0 -t tcp -p 9050.
Charlie |
|
Back to top |
|
 |
Vishy |
Posted: Thu Sep 11, 2003 12:00 pm Post subject: Thanks. |
|
|
Novice
Joined: 30 Jul 2003 Posts: 21
|
Thanks for all the input, I was getting the 2059 error because I was using localhost. |
|
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
|
|
|
|