Posted: Mon Nov 07, 2005 3:22 pm Post subject: Windows/Linux MQ Put Java Class
Newbie
Joined: 07 Nov 2005 Posts: 1
Newbie to the forum: PLEASE HELP!!
I have a specific situation that I am trying to work through. I have an MQ Server v 6.0 running on a Linux (Fedora Core 3) machine. I have a queuemanager, queue and listener configured (port 1414).
On my other machine I have windows XP with MQ Server v 6.0. I am running a Java class (see below) to put a message on a queue.
All this class is doing is creating a connection reading in a text file and dropping it on the queue on the linux machine. I created the identical environment to the linux machine on the windows box and was able to create the connection and send the text message properly. The error I get when trying to do a remote put is:
javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for '172.17.4.6:IDENTQM'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:546)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:1450)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:960)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:159)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:77)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:142)
at mqSender.MQSender.sendMessages(MQSender.java:133)
at mqSender.MQSender.main(MQSender.java:43)
I have researched this and have found that this error is a connection issue with the queuemanager. I am certain that the queuemanager and queue are configured properly on the linux machine because the mqput program that comes with MQ is able to put a message on the queue and get it off afterwards.
In order to rule out a network issue I installed Eclipse on the linux machine and ran the class from the machine that the MQ server is running on and still got the same error. I am starting to think that the java class I have is wrong in someway. I have used similar classes in the past to pull and put messages from local queues but always on windows and I have yet to perform such tasks on linux.
Any assistance with my environment setup or with my Java would be greatly appreciated.
public static void main(String args[])
{
MQSender MQTest = new MQSender();
//MQTest.getMessageFileNames(sFilename);
MQTest.getMessages();
MQTest.sendMessages();
}
public MQSender()
{
super();
}
//=========================================================================
/** Get the names of the files containing the MQ messages
*/
private void getMessageFileNames(String filename)
{
File f = new File(filename);
if ( !f.exists() ) {
System.out.println("The messages file does not exist.");
System.exit(0);
}
outMessageFiles = new Vector();
try {
FileInputStream fstream = new FileInputStream(filename);
BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
String line;
} catch (IOException e) {
System.out.println("There was an error reading the messages file: " + e.toString());
}
if ( outMessageFiles.size() == 0 ) {
System.out.println("The file does not list any message files.");
System.exit(0);
}
}
//=========================================================================
/** Get the messages from the message files
*/
private void getMessages()
{
String filename= "";
outMessages = new Vector();
StringBuffer message;
try {
FileInputStream fstream = new FileInputStream("C:/identTest1.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
line = in.readLine();
in.close();
fstream.close();
} catch (IOException e) {
System.out.println("There was an error reading the message file '" + filename + "': " + e.toString());
}
}
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