|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
The notorious 2059 again (Socket connection attempt refused) |
« View previous topic :: View next topic » |
Author |
Message
|
samchan80 |
Posted: Mon Jan 16, 2006 9:37 am Post subject: The notorious 2059 again (Socket connection attempt refused) |
|
|
Newbie
Joined: 16 Jan 2006 Posts: 2
|
Hi,
I am a kinda newbie to wesphere MQ, but i'm putting up this post only after looking up a lot of forums/posts on this topic, and out of sheer curiosity and frustration as to why I still haven't been able to solve the problem.
I have Websphere MQ 6 installed on a Windows XP machine (server) and have a queue set up. Now, I'd like to read the queue messages from another (remote) machine on the network using Java.
I have the Queue manager running on the server. The listener is up too. All this is set up with the same port number (I'm using the default 1414). I initially created a new server-connection channel, but since that didn't work, now trying with the default SYSTEM.DEF.SVRCONN channel. Also, I know that all names are case-sensitive and I have taken care of that.
I am still getting the error:
MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused
Here is the JAVA code (slightly modified version of the mqbrowse.java sample) that I use to connect: (FYI, this code works perfectly when i run it locally on the server machine itself)
Please let me know if there's something else I need to do on the server/client machines. Thanks a lot.
import com.ibm.mq.*; // Include the MQ package
import java.io.*;
import java.lang.*;
public class sambrowse {
private MQQueueManager qMgr;
public static void main (String args[]) throws IOException {
if (args.length < 1) {
System.out.println("Required parameter missing - queue name");
} else {
System.out.println("mqbrowse: browse and optionally get messages");
sambrowse mySample = new sambrowse();
mySample.init();
mySample.start(args);
}
System.exit(0);
}
public void init() {
}
public void start(String args[]) {
try {
/******************************************************/
/* Create a queue manager object and access the queue */
/* that will be used for the putting of messages. */
/******************************************************/
MQEnvironment.hostname = "192.168.10.44"; // host to connect to
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
MQC.TRANSPORT_MQSERIES);
if (args.length > 1) {
qMgr = new MQQueueManager(args[1]);
} else {
qMgr = new MQQueueManager("QM_sameerc");
}
int openOptions = MQC.MQOO_INPUT_EXCLUSIVE | MQC.MQOO_BROWSE;
MQQueue myQueue = qMgr.accessQueue(args[0], openOptions);
/*****************************************/
/* Set up a reader to get the user input */
/*****************************************/
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String runShow;
/******************************************************/
/* Set up our options to browse for the first message */
/******************************************************/
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
MQMessage myMessage = new MQMessage();
/***************************/
/* Set up a loop exit flag */
/***************************/
boolean done = false;
do {
try {
/*****************************************/
/* Reset the message and IDs to be empty */
/*****************************************/
myMessage.clearMessage();
myMessage.correlationId = MQC.MQCI_NONE;
myMessage.messageId = MQC.MQMI_NONE;
/**************************************************/
/* Browse the message, display it, and ask if the */
/* message should actually be gotten */
/**************************************************/
myQueue.get(myMessage, gmo);
String msg = myMessage.readString(myMessage.getMessageLength());
System.out.println("Browsed message: \n" + msg + "\n");
System.out.println("Browse Next message?");
runShow = br.readLine();
if (runShow.length() > 0) {
if ( (runShow.indexOf("Y") != -1)
|| (runShow.indexOf("y") != -1) ) {
/*System.out.println("Actually getting the message");
gmo.options = MQC.MQGMO_MSG_UNDER_CURSOR;
myQueue.get(myMessage, gmo);*/
}
else{
done=true;
}
}
/************************************************/
/* Reset the options to browse the next message */
/************************************************/
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
} catch (MQException ex) {
/**************************************************/
/* Probably encountered our no message available: */
/* write out error and mark loop to be exited */
/**************************************************/
System.out.println("MQ exception: CC = " + ex.completionCode
+ " RC = " + ex.reasonCode + "\n No more messages in queue");
done = true;
} catch (java.io.IOException ex) {
System.out.println("Java exception: " + ex);
done = true;
}
} while (!done);
/**********************************************************/
/* Before the program ends, the open queue will be closed */
/* and the queue manager will be disconnected. */
/**********************************************************/
myQueue.close();
qMgr.disconnect();
}
catch (MQException ex) {
System.out.println("MQ exception: CC = " + ex.completionCode
+ " RC = " + ex.reasonCode);
}
}
}
Thanks,
Sameer |
|
Back to top |
|
 |
samchan80 |
Posted: Mon Jan 16, 2006 12:32 pm Post subject: SOLVED! |
|
|
Newbie
Joined: 16 Jan 2006 Posts: 2
|
Well...
i spent sooo much time on this......and now i come to know that there was nothing wrong with what i was doing.....
the issue was with the network settings on my machine.....
XP service pack 2 installed the Windows firewall and it was ON by default ! (so it would accept no incoming requests!)
but since I could connect to the client computer and also cos the client machine could PING mine, I didn't think I would have a network issue.
Anyways, feeling a li'l stupid.....but a helluva lot relieved!!
cheers,
sameer |
|
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
|
|
|
|