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 » IBM MQ Java / JMS » Reason code 2009

Post new topic  Reply to topic
 Reason code 2009 « View previous topic :: View next topic » 
Author Message
Joyce
PostPosted: Sun Nov 28, 2004 5:47 am    Post subject: Reason code 2009 Reply with quote

Newbie

Joined: 28 Nov 2004
Posts: 6

Hello everyone,

I am testing a java program but I got an MQException of MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009

I have specified the mq parameters like these:
private static String hostname = "n.n.n.n" ;

// Define name of channel for client to use
private static String channel = "channel1" ;


// Define name of queue manager object to connect to
private static String qManager = "queue.manager.1" ;

I am running this program on the machine on which MQ server is installed. I am not sure what special set up I should do in order to fix my problem?

By the way, to test client-server communication, can I test it on server machine only, so the client actually is running on the same machine with the MQ server?

Thanks for your time.

Joyce
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 28, 2004 6:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Post the code.
Back to top
View user's profile Send private message Send e-mail
clindsey
PostPosted: Sun Nov 28, 2004 8:31 am    Post subject: Reply with quote

Knight

Joined: 12 Jul 2002
Posts: 586
Location: Dallas, Tx

Yes, you can run in client mode on the same machine as the queue manager. Since you are not setting the port, MQ uses the default of 1414 and this is just fine. Make sure you are starting a listerner (runmqlsr) on port 1414 for your queue manager.

Charlie
Back to top
View user's profile Send private message
csmith28
PostPosted: Sun Nov 28, 2004 11:08 am    Post subject: Reply with quote

Grand Master

Joined: 15 Jul 2003
Posts: 1196
Location: Arizona

Quote:
2009 X’07D9’ MQRC_CONNECTION_BROKEN
Connection to the queue manager has been lost. This can occur because the queue manager
has ended. If the call is an MQGET call with the MQGMO_WAIT option, the wait has been
canceled. All connection and object handles are now invalid.
For WebSphere MQ client applications, it is possible that the call did complete successfully,
even though this reason code is returned with a CompCode of MQCC_FAILED.
Corrective action: Applications can attempt to reconnect to the queue manager by issuing the
MQCONN or MQCONNX call. It may be necessary to poll until a successful response is
received.
On z/OS for CICS applications, it is not necessary to issue the MQCONN or MQCONNX call,
because CICS applications are connected automatically.
Any uncommitted changes in a unit of work should be backed out. A unit of work that is
coordinated by the queue manager is backed out automatically.


Please post the platform and OS Level. WMQ Version.

Have you tried to use the sample programs amqsput or amqsputc?
_________________
Yes, I am an agent of Satan but my duties are largely ceremonial.
Back to top
View user's profile Send private message
Joyce
PostPosted: Sun Nov 28, 2004 6:39 pm    Post subject: Reply with quote

Newbie

Joined: 28 Nov 2004
Posts: 6

Thanks everybody.

This is the java code:

------------------------------------------------------------
import com.ibm.mq.*; // Include the MQ package

public class MQTester{
// Define the name of your host to connect to
private static String hostname = "n.n.n.n" ;

// Define name of channel for client to use
private static String channel = "channel1" ;


// Define name of queue manager object to connect to
private static String qManager = "queue.manager.1" ;

// define a queue manager object
private static MQQueueManager qMgr;

public static void main( String[] args){
init();
start();
}
/***************************************************************
* INITIALIZATION *
****************************************************************/
// When the class is called, this initialisation is done first.
public static void init(){
// Set up MQ environment
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel; } // end of init

public static void start(){
try {
/***********************************************************
* CONNECT *
***********************************************************/
// Create a connection to the queue manager
qMgr = new MQQueueManager(qManager);
/***********************************************************
* OPEN *
***********************************************************/
// Set up the options on the queue we wish to open...
// Note: All MQ Options are prefixed with a

//int openOptions = MQC.MQOO_INPUT_AS_Q_DEF;
int openOptions = MQC.MQOO_OUTPUT ;


// Note: MQOO_INQUIRE & MQOO_SET are always by default.
// Now specify the queue that we wish to open,
// and the open options...
MQQueue system_default_local_queue = qMgr.accessQueue("queue1" ,
openOptions,
null, // default queue manager
null, // no dynamic queue name
null); // no alternate user ID
/******************************************************************
* MESSAGE *
******************************************************************/
// Define a simple MQ message,
// and write some text in UTF format..
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!" ) ;

/*************************************************************
* PUT *
***************************************************************/
// Specify the message options...
// (accept the defaults, same as MQPMO_DEFAULT constant)
MQPutMessageOptions pmo = new MQPutMessageOptions();
// Put the message on the queue
system_default_local_queue.put(hello_world,pmo);

/*********** ***************************************************
* GET *
****************************************************************/
// Get the message back again...
// First define a MQ message buffer to receive the
// message into
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
// Set the get message options..
// (accept the defaults, same as MQGMO_DEFAULT)
MQGetMessageOptions gmo = new MQGetMessageOptions();
// get the message off the queue...
system_default_local_queue.get(retrievedMessage, gmo);
/*****************************************************************
* DISPLAY *
****************************************************************/
// Prove we have the message by displaying the
// UTF message text.
String msgText = retrievedMessage.readUTF();
System.out.println("The message is: " + msgText);
/*****************************************************************
* CLOSE *
******************************************************************/
// Close the queue
system_default_local_queue.close();
/*********************** ****************************
* DISCONNECT *
******************************************************************/
// Disconnect from the queue manager
qMgr.disconnect();
}
/******************************************************************
* ERROR HANDLING *
******************************************************************/
// If an error has occured in the above, try to identify what went wrong.
// Was it an MQ error?
catch (MQException ex){
System.out.println("An MQ error occurred : Completion code " +
ex.completionCode +
" Reason code " + ex.reasonCode);
}
// Was it a Java buffer space error?
catch (java.io.IOException ex){
System.out.println("An error occurred while writing to the message buffer: " + ex);
}
} // end of start
} // end of sample

--------------------------------------------------------------------
I am using MQ5.3.0.2 (service level: CSD01) running on windows 2000. I could not get the sample program working either. The listenner is runnning for queue.manager.1, I have checked.


when I test using the sample provided :
amqsputc SYSTEM.DEFAULT.LOCAL.QUEUE queue.manager.1

and get: Sample AMQSPUT0 start
MQCONN ended with reason code 2058

Very appreciate.

Joyce
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Nov 28, 2004 7:29 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Make sure the channel name is correct and qmgr name is correct . Use dspmq and runmqsc to check it .
Remember that case DOES matter.

Make sure your channel is of type svrconn.

You do not specify a port in your environment. Be sure to specify the port the MQ Listener is running on. (Default is 1414).

Make sure the qmgr and MQListener are running. (See MQServices in windows or ps -ef | grep mqlsr on Unix)

Enjoy
Back to top
View user's profile Send private message Send e-mail
Joyce
PostPosted: Sun Nov 28, 2004 8:58 pm    Post subject: Reply with quote

Newbie

Joined: 28 Nov 2004
Posts: 6

I have checked it again and again and make sure I used the correct case, but I still have problem with running the sample amqsputc. I even dare not try my java programming.

Can anyone please tell me what you did to run the sample amqsputc?

Thanks!
Back to top
View user's profile Send private message
Joyce
PostPosted: Mon Nov 29, 2004 1:44 am    Post subject: Reply with quote

Newbie

Joined: 28 Nov 2004
Posts: 6

Hello,

I could run amqsput successfully. Not sure what is the difference between amqsput and amqsputc. Anyway, the sample program is working for me now and I am aimming to fix the reason code 2009 now.

thanks,
Joyce
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Nov 29, 2004 6:16 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Joyce wrote:
Not sure what is the difference between amqsput and amqsputc.


amqsput connects to the qmgr using bindings mode (ie, inter-process communication).

amqsputC connects to the qmgr using client mode (ie, tcp/ip). amqsputC will require a listener to be running.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
clindsey
PostPosted: Mon Nov 29, 2004 7:12 am    Post subject: Reply with quote

Knight

Joined: 12 Jul 2002
Posts: 586
Location: Dallas, Tx

In another thread you indicated that you created a listener from MQExplorer. Maybe you did not set the port to 1414. From your symptoms, it sure sounds like you do not have listerner on this port or your client cannot get to it because of a firewall (ZoneAlarm, etc).

First, go to a command window and enter 'netstat -an > c:\temp\netstat.out'. Then edit c:\temp\netstat.out and search for 1414. There must be an entry where state is LISTENING. If not, you do not have a listener running on port 1414.

As long as you are testing on the same machine, use 'localhost' rather than fully qualified hostname. I believe this will allow a connection even if you have a firewall running. If you can connect to localhost but not real hostname, then you need to examine the network setup.

Charlie
Back to top
View user's profile Send private message
Joyce
PostPosted: Mon Nov 29, 2004 5:35 pm    Post subject: Reply with quote

Newbie

Joined: 28 Nov 2004
Posts: 6

Thanks a lot!

I made sure the listener is listening 1414 now and the error has gone but a new one comes as following:

MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused

I think the continuous errors are caused by my confusion. Please let me explain what I have practised and thanks for your time.

1. I could run amqsput but could not run amqsputC. Do not know why. I am sure the listenner is running because I have checked both the MQServices and command line "netstat an"

2. I tried out sever to server connection yesterday using amqapi. It was successful. On my machine What I did was to define a sender channel and receiver channel. And then define one local queue and remote queue, finally define a transmission queue which is used by the romote queue. In trigger date field of transmission queue I entered the sender channel. I also got all the queue and queue manager information from another server machine. It was working.

3. My goal is to achieve server to server conmmunication. I would like a queue trigger to trigger a java application to process messages on the queue and then put the same messages to a different queue. The java application does not need to reply the server. I am not sure in my application I should use client channel or sender/receiver channel. Should I use client server connection or server to server connection? I know I need to specify a channel in the program.

4. I also tried to test client and server connection on windows 2000 but did not have any luck. First I created a local queue on the server and started the listener on port 1418, and created a server connection channel too. On the client machine, I created a client channel with the same name as server channel, and a transmission queue. I also set the enviornment variable on the client machine too. Could you please tell me what I did wrong?

Thank you very much.

Joyce
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Nov 30, 2004 4:26 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

For a client to connect to the qmgr you need a SVRCONN channel on the server and if you are using the chltab environment a corresponding client channel.

Enjoy
Back to top
View user's profile Send private message Send e-mail
slaupster
PostPosted: Mon Dec 06, 2004 5:08 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2004
Posts: 41

It sounds like you need to read the app programming guide. In order to get QMGRs talking, i.e. host remote queues, you need a sender and receiver channel defined between the 2 QMGRs.

In order for you to make MQI calls against any QMGR, to local or remote queues, you need an MQI channel, SVRCONN in this case.

It sounds like you have got this far, and that the channel is running, but you get refused a connection for some reason. If the problem is not at the TCP layer, MQ should give you some log/fdc indicating why the conection was refused. You may find that it is becasue the user id that is flowed across the channel by your client is not authorised or does not exist on the QMGR host machine. Setting the MCAUSER on the channel to 'mqm' will resolve this issue if this is the case.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Reason code 2009
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.