ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » Java MQ error --help required

Post new topic  Reply to topic
 Java MQ error --help required « View previous topic :: View next topic » 
Author Message
Vishy
PostPosted: Thu Sep 11, 2003 8:17 am    Post subject: Java MQ error --help required Reply with quote

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
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Thu Sep 11, 2003 8:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you sure your listener is running on port 9050?
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Sep 12, 2003 3:12 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Java MQ error --help required
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.