|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQJE01:An Exception Occurr:Reason 2059 |
« View previous topic :: View next topic » |
Author |
Message
|
Gowher |
Posted: Mon Oct 10, 2005 11:18 pm Post subject: MQJE01:An Exception Occurr:Reason 2059 |
|
|
Newbie
Joined: 10 Oct 2005 Posts: 1
|
hi
i am new to MQ Websphere.I am trying to send and get message from message queue using sample code.My os is windows xp.When i run my sample code(MQSample.class)it throws Exception as follows
MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused
My approch to run my sample code is as follows
-------------------------------------------------------
Step 1:
i open dos panel then i type following command
strmqm
runmqsc
it displays following message
5724-H72 (C) Copyright IBM Corp. 1994, 2004. ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM_sw12.
Step 2:
Now i open another dos panel and i try to run MQSample class but it throws exception as shown above(MQJE001).
I have tested MQIVP class file and it works fine as shown below
C:\JMS_Progs\MQBaseProg>java MQIVP
Websphere MQ for Java Installation Verification Program
5724-B4 (C) Copyright IBM Corp. 2002. All Rights Reserved.
===========================================================
Please enter the IP address of the MQ server :192.168.0.20
Please enter the port to connect to : (1414)
Please enter the server connection channel name :JAVA.CHANNEL
Please enter the queue manager name :QM_sw12
Success: Connected to queue manager.
Success: Opened SYSTEM.DEFAULT.LOCAL.QUEUE
Success: Put a message to SYSTEM.DEFAULT.LOCAL.QUEUE
Success: Got a message from SYSTEM.DEFAULT.LOCAL.QUEUE
Success: Closed SYSTEM.DEFAULT.LOCAL.QUEUE
Success: Disconnected from queue manager
Tests complete -
SUCCESS: This MQ Transport is functioning correctly.
Press Enter to continue ...
I have used same parameters in my own code
I have already set all environment variables.
I want to know is my approch right or wrong.If i am right then why my
code throws exception whenever MQIVP class is working fine.
My code is
------------
import java.text.*;
import java.io.*;
import java.util.*;
import java.lang.reflect.*;
import com.ibm.mq.*; //Include the WebSphere MQ classes for Java package
import com.ibm.mq.MQException;
public class MQSample {
// define the name of the QueueManager
private static final String qManager = "QM_sw12";
// and define the name of the Queue
private static final String qName = "SYSTEM.DEFAULT.LOCAL.QUEUE";
Properties properties = new Properties(); // Contains system settings.
// main method: simply call the runSample() method
public static void main(String args[]) {
new MQSample().runSample();
}
public void runSample() {
try
{
// Load system properties from file
FileInputStream fis = new FileInputStream("properties.ini");
properties.load(fis);
fis.close();
// List system properties
ByteArrayOutputStream baos = new ByteArrayOutputStream();
properties.list(new PrintStream(baos));
System.out.println(baos.toString());
// Prepare MQ Series environment
String chl = properties.getProperty("CHANNEL_NAME");
String host = properties.getProperty("HOST_NAME");
String port = properties.getProperty("PORT");
String qmgr = properties.getProperty("QUEUE_MANAGER");
MQEnvironment.properties.put(MQC.HOST_NAME_PROPERTY, host);
MQEnvironment.properties.put(MQC.PORT_PROPERTY, port);
MQEnvironment.properties.put(MQC.CHANNEL_PROPERTY, chl);
PrintStream out1 = new PrintStream(
new BufferedOutputStream (
new FileOutputStream("mqtrace.out")));
MQEnvironment.enableTracing(5, out1);
}
catch (Exception e)
{
e.printStackTrace();
}
try {
//----------------------------------------------------------------------------------------
// Create a connection to the QueueManager
System.out.println("Connecting to queue manager: "+qManager);
MQQueueManager qMgr = new MQQueueManager(qManager);
// Set up the options on the queue we wish to open
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
System.out.println("Accessing queue: "+qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);
// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
// ... and write some text in UTF8 format
msg.writeUTF("Hello, World!");
// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message to the queue
System.out.println("Sending a message...");
queue.put(msg, pmo);
// Now get the message back again. First define a WebSphere MQ message
// to receive the data
MQMessage rcvMessage = new MQMessage();
// Specify default get message options
MQGetMessageOptions gmo = new MQGetMessageOptions();
// Get the message off the queue.
System.out.println("...and getting the message back again");
queue.get(rcvMessage, gmo);
// And display the message text...
String msgText = rcvMessage.readUTF();
System.out.println("The message is: " + msgText);
// Close the queue
System.out.println("Closing the queue");
queue.close();
// Disconnect from the QueueManager
System.out.println("Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println("Done!");
}
catch (MQException ex) {
System.out.println("A WebSphere MQ Error occured : Completion Code "
+ ex.completionCode + " Reason Code " + ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("An IOException occured whilst writing to the message buffer: "
+ ex);
}
}
}
Thanks in advance. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 11, 2005 3:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please try harder.
2059 is the important piece of information. Please go find out what that means.
Then find out all of the other thousand times that we have discussed this problem.
Please *try* harder. _________________ 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
|
|
|
|