Link to home
Start Free TrialLog in
Avatar of Dawn_rico
Dawn_rico

asked on

MQSeries base Java configuration

hi all Experts,

I'm at this page now configuring my client after installing MQ base Java to test my connection to the server.
 
http://www-4.ibm.com/software/ts/mqseries/library/manuals99/csqzaw/csqzaw0p.htm#HDRCSQ770W

I have configured my queue manager to accept the client connections. May I know what do they mean by :

"2.Change to your samples directory"

Thanks ..

Dawn.
Avatar of Dawn_rico
Dawn_rico

ASKER

hi Experts,

For more info, the chapters can be found in http://www-4.ibm.com/software/ts/mqseries/library/manuals99/csqzaw/csqzaw.htm#ToC
_________________________________________________________
and pardon me, actually I dun understand what do they mean by giving us the installation directories inside "Table 2. MQ base Java V 5.1 installation directories" inside this link -
http://www-4.ibm.com/software/ts/mqseries/library/manuals99/csqzaw/csqzaw0k.htm#Header_22
_________________________________________________________
I'm also unsure of how to update CLASSPATH environment variable inside "Table 3. Sample CLASSPATH statements for the client and server".
_________________________________________________________
Can pls update me on how to do them?

Thanks in advance.

Dawn.
Hi again !

Well when you installed the MQ Series java classes, you must would have given an install dir... lets say in D:\Program Files. Then it would install all your MQ java classes in this dir D:\Program Files\MQSeries\Java\ under this folder you will see a samples folder i.e.

D:\Program Files\MQSeries\Java\samples....You need to go to a base folder under this directory ie
D:\Program Files\MQSeries\Java\samples\base

This is where the MQIVP class resides :-).  One piece of advice -(if you've done this already then please forgive me). Do make ABSOLUTELY sure you have the lib folder (D:\Program Files\MQSeries\Java\lib) in you PATH [LD_LIBRARY_PATH - if your on some flavor of Unix] as well as CLASSPATH environment variables.

Try it out :-)

regards gtloafer
hi Experts,

For more info, the chapters can be found in http://www-4.ibm.com/software/ts/mqseries/library/manuals99/csqzaw/csqzaw.htm#ToC
_________________________________________________________
and pardon me, actually I dun understand what do they mean by giving us the installation directories inside "Table 2. MQ base Java V 5.1 installation directories" inside this link -
http://www-4.ibm.com/software/ts/mqseries/library/manuals99/csqzaw/csqzaw0k.htm#Header_22
_________________________________________________________
I'm also unsure of how to update CLASSPATH environment variable inside "Table 3. Sample CLASSPATH statements for the client and server".
_________________________________________________________
Can pls update me on how to do them?

Thanks in advance.

Dawn.
Dawn
 
   Ok here goes. First of all are you installing this on Windows NT, or Unix ? (The way classpaths are set on both these platforms vary slightly). I need to know this in order to provide more info.
Windows NT, thanks gtloafer
Dawn
 
   Ok here goes. First of all are you installing this on Windows NT, or Unix ? (The way classpaths are set on both these platforms vary slightly). I need to know this in order to provide more info.
hi gtloafer ,

mine is at C:\Program Files\IBM\MQSeries\Java\samples\base and I have found the lib folder too. Pardon me, but I dunno what am I suppose to configure with respect to the 2 tables.  

"Table 2. MQ base Java V 5.1 installation directories"
"Table 3. Sample CLASSPATH statements for the client and server".

thanks ...and I really need ur help ...
I've went to this file -
at C:\tmp\program files\IBM\MQSeries\Java\samples\base\en_US\mqjavac.html

and test my client connection. An applet window appears and this sentences show:

MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

mm..does this means that my connection is successful?

thanks ..

Dawn
Windows NT ? Cool.

You have to have some information ready with you. When you installed the program (the typical install shield kind ), it should have prompted you for a directory location. So if you gave say D:\Program Files\MQSeries then this would be the value you substitute for install dir(italics text in that table).

To set the classpath you can do this like so : click on
 Start Button >> Settings  >> Control Panel >> System Icon  [System props dialog pops up] >> click environment tab >> You will see two list boxes below which are two text fields. The first list box holds System environment vars. The second holds User environment vars. Look in the second list box you should see a CLASSPATH variable. click on it... Immediately the two text fields at the bottom will be filled with some text. The first text field is the environment variable name. The second text box contains it's value. Just scroll to the end of this second text box then enetr additional paths here after adding a semi-colon (;) eg ;D:\Proggy\MQSeries\Java\lib\com.ibm.mq.jar;D:\Proggy\MQSeries\Java\lib\jms.jar   .  once you are done press 'set ' and apply . You now have set a classpath var.

If you dont see a classpath var then here's what do you do :- click in the user environment variables list box. Then click in the first textbox and type :- CLASSPATH
In the second textbox (this holds the value ) type the following :- %CLASSPATH%;D:\Whatever\Path\You\want; Try it out and lemme know

Sorry Dawn ... looks like u posted some queries while i was responding to one of the initial questions .. :-)
I've tried running this file in JBuilder and a window appears, showing an empty screen, but there's no error msg. Do I need to include anything more?

My code:

// ======================================================================
// Licensed Materials - Property of IBM
// 5639-C34
// (c) Copyright IBM Corp. 1995, 1999
// ======================================================================
// MQSeries classes for Java sample application
// http://www-4.ibm.com/software/ts/mqseries/library/manualsa/csqzaw04/csqzaw1f.htm#IDX321
//
// This sample runs as a Java application using the command :- java MQSample
// - Connect to a queue manager
// - Put a message onto SYSTEM.DEFAULT.LOCAL.QUEUE
// - Get the message back again

import com.ibm.mq.*;            // Include the MQSeries classes for Java package

import java.util.Hashtable;     // Required for properties

public class MQSample
{
  private String qManager = "your_Q_manager";  // define name of queue
                                               // manager to connect to.
  private MQQueueManager qMgr;                 // define a queue manager
                                               // object
  public static void main(String args[]) {
     new MQSample();
  }

  public MQSample() {
   try {

      java.util.Hashtable properties;

      // Create a connection to the queue manager
      qMgr = new MQQueueManager(qManager);

      // Set up the options on the queue we wish to open...
      // Note. All MQSeries Options are prefixed with MQC in Java.


      //MQOPEN (Open object) call
      //http://www-4.ibm.com/software/ts/mqseries/library/manuals/mqw21/AMQ45M2U.HTM
      int openOptions = MQC.MQOO_INPUT_AS_Q_DEF 3
                        MQC.MQOO_OUTPUT ;

      // Now specify the queue that we wish to open,
      // and the open options...
      MQQueue system_default_local_queue =
              qMgr.accessQueue("SYSTEM.DEFAULT.LOCAL.QUEUE",
                               openOptions,
                               null,           // default q manager
                               null,           // no dynamic q name
                               null);          // no alternate user id

      // Define a simple MQSeries message, and write some text in UTF format..

      MQMessage hello_world = new MQMessage();
      hello_world.writeUTF("Hello World!");

      // specify the message options...

      MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the // defaults,
                                                           // same as MQPMO_DEFAULT
      // put the message on the queue

      system_default_local_queue.put(hello_world,pmo);

      // get the message back again...
      // First define a MQSeries message buffer to receive the message into..

      MQMessage retrievedMessage = new MQMessage();
      retrievedMessage.messageId = hello_world.messageId;

      // Set the get message options...

      MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults
                                                           // same as  MQGMO_DEFAULT
      // get the message off the queue...

      system_default_local_queue.get(retrievedMessage, gmo);

      // And prove we have the message by displaying the UTF message text

      String msgText = retrievedMessage.readUTF();
      System.out.println("The message is: " + msgText);
      // Close the queue...
      system_default_local_queue.close();
      // Disconnect from the queue manager

      qMgr.disconnect();
    }
   // If an error has occurred in the above, try to identify what went wrong
   // Was it an MQSeries error?
    catch (MQException ex)
    {
      System.out.println("An MQSeries 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 whilst writing to the message buffer: " + ex);
    }
  }
} // end of sample

Ok dont worry. IBM just put those directories to psyche u ;-). Just kidding. Well Table 2 is merely informatory it just shows you what directories the install created. As such you only need be concerned with the OS/2 / Windows NT entries. I highly recommend browsing these directories.

Next in my previous posts I'd explained how to set the CLASSPATH ..Now in table 3 look at the classpath entries for Windows NT.. you'll have to put all these directories in your classpath.
This is in response to ur post

*********************8
I've went to this file -
at C:\tmp\program files\IBM\MQSeries\Java\samples\base\en_US\mqjavac.html

and test my client connection. An applet window appears and this sentences show:

MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

mm..does this means that my connection is successful?

thanks ..

Dawn
********************

Try running that file thru applet viewer after cd'ing to the directory from a dosprompt

appletviewer mqjavac.html.

You should see output similar to the following :--



MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================


Verifying that host can be accessed.
If you are running a listener, the messages
"Connection to host '<your host>' closed.",
"The TCP/IP responder program could not be started."
may appear in its console during this test.

If the hostname is valid, but the host does not respond
to the connection request then you may have to wait for a
timeout to expire...


Success: Accessed host localhost.


MQ testing will now begin...
If you are running this test over the web, it may take some time
to download the MQ classes, depending on the speed of your
link.


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 -
Now with repect to that code u ran in JBuilder. You have to make some changes there :-). Nothing works first time so dont worry :).

See the following line :-
////////////////////////////

private String qManager = "your_Q_manager";  // define name of queue
                                              // manager to connect to.
/////////////////////////////

you'll have to  put a valid q manager name in there :)
Thanks gtloafer :)
_________________________________________________________
G:
Ok dont worry. IBM just put those directories to psyche u ;-). Just kidding. Well Table 2 is merely
informatory it just shows you what directories the install created. As such you only need be concerned
with the OS/2 / Windows NT entries. I highly recommend browsing these directories.
---------
D:
sure, I'll look thr them ..(later)
_________________________________________________________
G:
Next in my previous posts I'd explained how to set the CLASSPATH ..Now in table 3 look at the classpath
entries for Windows NT.. you'll have to put all these directories in your classpath.
--------
D:
I've went to the place as you've directed and set them like this -

C:\Program Files\IBM\MQSeries\Java\Lib;C:jdk_dir\lib\classes.zip;install_dir\lib\com.ibm.mq.jar;install_dir\lib\com.ibm.mq.iiop.jar;install_dir\lib\connection.jar;install_dir\lib\;install_dir\samples\base\;

I've copy them directly like what's shown in the table.

<b>Windows NT</b>
CLASSPATH=C:jdk_dir\lib\classes.zip;
install_dir\java\lib\com.ibm.mq.jar;
install_dir\java\lib\com.ibm.mqiiop.jar; install_dir\java\lib\com.ibm.mqbind.jar;
install_dir\java\lib\;
install_dir\tools\javaclnt\samples\lang_dir;

_______________________________________________________
G:
Verifying that host can be accessed.
If you are running a listener, the messages
"Connection to host '<your host>' closed.",
"The TCP/IP responder program could not be started."
may appear in its console during this test.

If the hostname is valid, but the host does not respond
to the connection request then you may have to wait for a
timeout to expire...


Success: Accessed host localhost.


MQ testing will now begin...
If you are running this test over the web, it may take some time
to download the MQ classes, depending on the speed of your
link.


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 -
-------------
D:
I've tried
C:\>java MQIVP
Exception in thread "main" java.lang.NoClassDefFoundError: MQIVP

but there's an error.

Sorry that I dun really understand ur way of doing this but this is what I'll really want to learn how to do. Can you pls kindly tell me what instructions to run?

Thanks ...

Dawn
Dawn
I need you to open a DOS window and type the following commands

C:\>set

C:\>echo %CLASSPATH%

and send the output. It will help me in determining whether the environment variables were setup ok. : )

After this I will be able to explain how we can get you running AOK ;-)


Oops your classpath setting was wrong. I only noticed it now

--------
D:
I've went to the place as you've directed and set them like this -

C:\Program Files\IBM\MQSeries\Java\Lib;C:jdk_dir\lib\classes.zip;install_dir\lib\com.ibm.mq.jar;install_dir\lib\com.ibm.mq.iiop.jar;install_dir\lib\connection.jar;install_dir\lib\;install_dir\samples\base\;


I've copy them directly like what's shown in the table.

<b>Windows NT</b>
CLASSPATH=C:jdk_dir\lib\classes.zip;
install_dir\java\lib\com.ibm.mq.jar;
install_dir\java\lib\com.ibm.mqiiop.jar; install_dir\java\lib\com.ibm.mqbind.jar;
install_dir\java\lib\;
install_dir\tools\javaclnt\samples\lang_dir;

_______________________________________________________
G:
In your classpath above wherever you see install_dir replace it with C:\Program Files\IBM\MQSeries\Java\
because based on one of ur earlier posts I saw u mentioned this directory.

eg the path:
install_dir\lib\com.ibm.mq.jar;

would become
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;

see nothing to it.

One more thing likewise for this directory
C:jdk_dir\lib\classes.zip

Notice the jdk_dir ...this refers to your java installation. Please let me know what version of java you are using and where you have installed it.


hi gtloafer,

my version is jdk 1.2.2

thanks ..
I've noticed that I dun have this "tool" folder - C:\Program Files\IBM\MQSeries\Java\
\tools\javaclnt\samples\lang_dir;

Hi Dawn

Where is your jdk installed ? And what does your classpath look like now ?
-----------------------------------------------------
D:

I've noticed that I dun have this "tool" folder - C:\Program Files\IBM\MQSeries\Java\
\tools\javaclnt\samples\lang_dir;

G:
Check if you have this folder then, as this is the one u ahould be looking at

C:\Program Files\IBM\MQSeries\Java\samples\base
-------------------------------------------------------

regards gtloafer
1]

It looks like this now.
C:\Program Files\IBM\MQSeries\Java\Lib;C:\jdk1.2.2\lib\classes.zip;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mqiiop.jar;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mqbind.jar;C:\Program Files\IBM\MQSeries\Java\lib\;C:\Program Files\IBM\MQSeries\Java\samples\;
====================================================
2]

I've tried executing this code :

C:\Program Files\IBM\MQSeries\Java\samples\base>java MQIVP
MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================
==================================================

Please enter the type of connection (MQSeries or VisiBroker)  : (MQSeries)
Please enter the IP address of the MQSeries server            :130.11.12.22
Please enter the port to connect to                           : (1414)
Please enter the server connection channel name               :Channel1
Please enter the queue manager name                           :queue.manager.1
MQJE020: CCSID not supported by queue manager
MQJE001: Completion Code 2, Reason 2195
Failure: Attempt to connect to queue manager failed.
        Reason: MQ Reason code 2195
        Action: Consult MQSeries Application Programming Reference for explanation.

=======================================================
I tried searching here.
http://www-4.ibm.com/software/ts/mqseries/library/manualsa/csqzak/csqzak6b.htm#HDRINDEX_START

I think you have helpped me a lot all this while with sincerity, hence I decided to increase the points for U.
Ok Dawn your classpath looks ok, so far so good. I need you to provide the following info... You can get  this info from your MQ Series Explorer (You know that neat little MMC utility...it will be under Start>>Programs>>IBM MQSeries>> MQ Series Explorer).

1) A Queue manager name (any one will do)
2) The name of a 'Server connection channel' setup for the
Queue Manager given above.
3) The port number for the queue manager

Please note the names are EXTREMELY CASE SENSITIVE. I could make a video of the bloopers I've made just because I was insensitive to the case in an object name.

I know this has been quite an ordeal but I feel we are almost there so hang in there ;)

Ok Dawn your classpath looks ok, so far so good. I need you to provide the following info... You can get  this info from your MQ Series Explorer (You know that neat little MMC utility...it will be under Start>>Programs>>IBM MQSeries>> MQ Series Explorer).

1) A Queue manager name (any one will do)
2) The name of a 'Server connection channel' setup for the
Queue Manager given above.
3) The port number for the queue manager

Please note the names are EXTREMELY CASE SENSITIVE. I could make a video of the bloopers I've made just because I was insensitive to the case in an object name.

I know this has been quite an ordeal but I feel we are almost there so hang in there ;)

hi gtloafer ,

Thanks .. sorry that I' couldn't try this out earlier .. was occupied with another matter ... I'll give you an anwser asap ..

Dawn.
sure :)
1) A Queue manager name (any one will do)

> queue.manager.1

2) The name of a 'Server connection channel' setup for the
Queue Manager given above.

> Channel1

3) The port number for the queue manager

> 1414

thanks :)

sorry that my reply has been late ...

Dawn.
Ok Dawn, Since you have installed MQ on your machine. I want you to run the MQIVP program -do verify using your MQ Series explorer that your Queue manager does not have any hiccups and is running fine-, give the same input as before but this time when prompted for the IP address give
the following: localhost

For all other things pass the same values as you had sent above(Queue manager name, Channel name). (btw the channel (Channel1) is a server connection channel right ?).
Hopefully you should see the following.

D:\PROGRA~1\MQSeries\Java\samples\base>java MQIVP
MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

Please enter the type of connection (MQSeries or VisiBroker)  : (MQSeries)
Please enter the IP address of the MQSeries server            :localhost
Please enter the port to connect to                           : (1414)
Please enter the server connection channel name               :drago
Please enter the queue manager name                           :SDS057
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 MQSeries Transport is functioning correctly.
Press Enter to continue ...




I tried running this on a separate client machine but it gives me error.

C:\Program Files\IBM\MQSeries\Java\samples\base>java MQIVP
MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

Please enter the type of connection (MQSeries or VisiBroker)  : (MQSeries)
Please enter the IP address of the MQSeries server            :localhost
Please enter the port to connect to                           : (1414)
Please enter the server connection channel name               :ClientConnection1
Please enter the queue manager name                           :queue.manager.1
MQJE011: Socket connection attempt refused
MQJE001: Completion Code 2, Reason 2059
Failure: Attempt to connect to queue manager failed.
        Reason: 2059 -The queue manager is not available.
        Action: Check the queue manager is running and retry.
Sorry Dawn,

I thought you would run the test on the actual machine where you have MQ Series 5.2 installed, please try that out and get back to me.

On a client it would not work for the follwing reason, the localhost reprsents a loopback IP address (127.0.0.1) ie it points to the machine on which the program is executing

Please run the test where you have both MQ Series as well as MQ Series classes for java.

regards gtloafer
gtloafer ,

Thanks for ur explanation. How do you think I can do to make it runnable on the client machine independently, cos' the server and client MQSeries must reside on different machines?

My queue manager is running on the server, have I missed out some other things in the connection process?  

I've set the class environment variables. I've started the MQSeries server
using the commands following
http://www-4.ibm.com/software/ts/mqseries/library/manualsa/csqzaw04/csqzaw0r
.htm :

C:\>strmqm queue.manager.1
There are 53 days left in the trial period for this copy of MQSeries.
MQSeries queue manager running.

C:\>runmqsc queue.manager.1
0784726, 5639-B43 (C) Copyright IBM Corp. 1994, 2000.  ALL RIGHTS RESERVED.
Starting MQSeries Commands.

C:\>runmqlsr -t tcp [-m queue.manager.1] -p 1414
0784726, 5639-B43 (C) Copyright IBM Corp. 1994, 2000.  ALL RIGHTS RESERVED.
Usage: runmqlsr [-m QMgrName] -t (TCP | LU62 | NETBIOS | SPX)
[ProtocolOptions]
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------------
and run the Client MQSeries using these commands:

C:\>SET MQSERVER=Channel1/TCP/DCPC721S

C:\>SET MQSERVER
MQSERVER=Channel1/TCP/DCPC721S

C:\>set
Classpath=C:\Program
Files\IBM\MQSeries\Java\Lib;C:\jdk1.2.2\lib\classes.zip;C:\Program
Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;C:\Program
Files\IBM\MQSeries\Java\lib\com.ibm.mqiiop.jar;C:\Program F
COMPUTERNAME=WARZONE
ComSpec=C:\WINNT\system32\cmd.exe
HOMEDRIVE=C:
HOMEPATH=\
INCLUDE=C:\Program Files\Mts\Include;C:\Program Files\MQSeries
Client\tools\cplus\include;C:\Program Files\MQSeries Client\tools\c\include
JAVA_HOME=c:\pjee3.1
LIB=C:\Program Files\Mts\Lib;C:\Program Files\MQSeries Client\tools\lib
LOGONSERVER=\\WARZONE
MQSERVER=Channel1/TCP/DCPC721S
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Os2LibPath=C:\WINNT\system32\os2\dll;
Path=D:\ORANT\bin;C:\Program
Files\Oracle\jre\1.1.7\bin;C:\WINNT\system32;C:\WINNT;C:\MSSQL7\BINN;C:\Prog
ram Files\Mts;d:\jdk1.3\bin;C:\Program Files\MQSeries Client\bin;C:\Program
Files\MQSeries Clien
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.JS;.VBE;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0803
PROMPT=$P$G
SystemDrive=C:
SystemRoot=C:\WINNT
TEMP=C:\TEMP
TMP=C:\TEMP
USERDOMAIN=WASTELAND
USERNAME=Administrator
USERPROFILE=C:\WINNT\Profiles\Administrator
windir=C:\WINNT

C:\Program Files\IBM\MQSeries\Java\samples\base>java MQIVP
MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

Please enter the type of connection (MQSeries or VisiBroker)  : (MQSeries)
Please enter the IP address of the MQSeries server            :computer_name
Please enter the port to connect to                           : (1414)
Please enter the server connection channel name
:ClientConnection1
Please enter the queue manager name
:queue.manager.1
MQJE011: Socket connection attempt refused
MQJE001: Completion Code 2, Reason 2059
Failure: Attempt to connect to queue manager failed.
       Reason: 2059 -The queue manager is not available.
       Action: Check the queue manager is running and retry.



thanks ..

Dawn.
sorry to bug for so long ..
On Client, I dun have the classes.zip file in the C:\jdk1.2.2\lib directory and also the language   directorydir\tools\javaclnt\samples\lang_dir for the installation.

My whole path is lke this:
C:\Program Files\IBM\MQSeries\Java\Lib;C:\jdk1.2.2\lib\classes.zip;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.iiop.jar;C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mqbind.jar;C:\Program Files\IBM\MQSeries\Java\lib\;C:\Program Files\IBM\MQSeries\tools\javacInt\samples\lang_dir;
I will have to do a wee bit of R&D as I have never tried running the admin commands from the command line. I always do it from my explorer... I'll get back on this real soon...

P.S Feel free to bug me any day !! :)

regards gtloafer
D:
How do you think I can do to make it runnable on the client machine independently,
cos' the server and client MQSeries must reside on different machines?

G:
I believe you need to install the MQSeries client application then.


D:
My queue manager is running on the server, have I missed out some other things in the connection process?

G:
Well I am not really sure on how you start the Q manager from a command line. (I do all my management from the MQSeries explorer and MQ Series Services explorer--which uses the Microsoft Managment Console -the easy way ;) ) So I will be guessing here ...from my MQ Series Services explorer I see
the Queue manager started, a Command Server started, a Channel Initiator started, a Listener started. I tried running the commands you mentioned modifying them appropriately for my q manager, but what I noticed is that while they started the queuemanager they did not start the Channel initiator. You need this fellow running. Could you try stopping and restarting your q manager from the MQ Series Explorer GUI interface ? After this open your MQ Services and click on your q manager and see if all services are running. Then run your test again :)

hi gtloafer,

I've done these:

>> Configure Server machine
      > Creating a queue manager and starting MQSC on the server
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF27.HTM#HDRUCH1ST
             # create a queue manager
                  C:\>crtmqm QM1
                  There are 52 days left in the trial period for this copy of MQSeries.
                  MQSeries queue manager created.
                  Creating or replacing default objects for QM1.
                  Default objects statistics : 29 created. 0 replaced. 0 failed.
                  Completing setup.
                  Setup completed.

             # start queue manager
                  C:\>strmqm QM1
                  There are 52 days left in the trial period for this copy of MQSeries.
                  MQSeries queue manager 'QM1' started.

      > Start MQSeries commands (MQSC)
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF27.HTM#HDRUCH1ST
            # start MQSeries commands
                  C:\>runmqsc QM1
                  0784726, 5639-B43 (C) Copyright IBM Corp. 1994, 2000.  ALL RIGHTS RESERVED.
                  Starting MQSeries Commands.

      > Defining the server connection
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF25.HTM#HDRUCHTAB
            # define a channel with chosen name and channel type of server connection (using first line and third line)
                  DEFINE CHANNEL(CHAN2) CHLTYPE(SVRCONN) TRPTYPE(TCP) +
                       1 : DEFINE CHANNEL(CHAN2) CHLTYPE(SVRCONN) TRPTYPE(TCP) +
                  DESCR('Server connection to Client_2')
                         : DESCR('Server connection to Client_2')
                  AMQ8014: MQSeries channel created.

                         :

                         :

      > Defining the client connection
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF25.HTM#HDRUCHTAB
            # define a channel with the same name and a channel type of client connection.
            # state the connection name (CONNAME). For TCP/IP this is the network address of the server machine.
            # specify the queue manager name (QMNAME) to let MQSeries application on client to connect to.
                  DEFINE CHANNEL(CHAN2) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
                       2 : DEFINE CHANNEL(CHAN2) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
                  CONNAME(130.34.13.65) QMNAME(QM1) DESCR('Client connection to Server_2')
                         : CONNAME(130.34.13.65) QMNAME(QM1) DESCR('Client connection to Server_2'
                  )
                  AMQ8014: MQSeries channel created.

      > Run the listener to start MQI channels
            # create listener in MQServices
                  QM1 > New > listener
                  
            # run listener
                  C:\>RUNMQLSR -t tcp -m QM1 -p 1414
                  0784726, 5639-B43 (C) Copyright IBM Corp. 1994, 2000.  ALL RIGHTS RESERVED.            

      > Run channel initiator
            # create channel initiator
                  QM1 > New > Channel Initiator

            # run listener
                  (right click)All Tasks > Start

==========================================================================================
>> Configure Client machine
      > Check that MQSeries client and server TCP/IP sessions are initialized
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF1P.HTM#Header_151
            # use ping commands
                  C:\>ping 130.34.13.65

                  Pinging 130.34.13.65 with 32 bytes of data:

                  Reply from 130.34.13.65: bytes=32 time<10ms TTL=128
                  Reply from 130.34.13.65: bytes=32 time<10ms TTL=128
                  Reply from 130.34.13.65: bytes=32 time<10ms TTL=128
                  Reply from 130.34.13.65: bytes=32 time<10ms TTL=128

      > Define client connection channel
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF1P.HTM#Header_151
            # create a client-connection channel by setting the MQSERVER environment variable
            # define channel name, transport type and channel connection name
                  C:\>SET MQSERVER=CHAN2/TCP/130.34.13.65(1414)

            # Verify channel definition by displaying the current setting
                  C:\>SET MQSERVER
                  MQSERVER=CHAN2/TCP/130.34.13.65(1414)

      > Putting a message on the queue
        http://www-4.ibm.com/software/ts/mqseries/library/manuals/csqzaf/CSQZAF1Q.HTM
            # put a message on the queue using the amqsputc sample program
                  C:\>cd c:\Program Files\MQSeries Client\bin

                  C:\Program Files\MQSeries Client\bin>amqsputc QUEUE1 QM1
                  Sample AMQSPUT0 start
                  MQCONN ended with reason code 2059

                  C:\Program Files\MQSeries Client\bin>amqsputc outfile.out infile.in QM1 QUEUE1
                  Sample AMQSPUT0 start
                  MQCONN ended with reason code 2059

==================================================================

I'vbe checked the reason:
(2059, X'80B') Queue manager not available for connection.
On an MQCONN call, the queue manager identified by the QMgrName parameter is not available for connection at this time.


On MVS/ESA, for CICS applications, this reason can occur on any call if the original connect specified a queue manager whose name was recognized, but which is not available.

On OS/400, this reason can also be returned by the MQOPEN and MQPUT1 calls, when MQHC_DEF_HCONN is specified for the Hconn parameter.
If the connection is from an MQ client application, this reason code can occur if there is an error with the client-connection or the corresponding server-connection channel definitions.

On MVS/ESA, this reason code can also occur if the optional MVS/ESA client attachment feature has not been installed.

This reason also occurs if an application attempts to connect to a queue manager within a group (see the QMgrName parameter of MQCONN), when none of the queue managers in the group is available for connection at this time.

Corrective action: Ensure that the queue manager has been started. If the connection is from a client application, check the channel definitions.

=======================================================================

but my queue manager has been started on server and I dunno what's missed out.
=======================================================================

Do you do this to run java applications?

http://www-4.ibm.com/software/ts/mqseries/support/summary/jvreadme.html#SAMPLES


     Running the IVT and Samples in TCP/IP mode
     ++++++++++++++++++++++++++++++++++++++++++

     The IVT and sample code supplied are set up to function in
     bindings mode. On platforms on which only TCP/IP mode is
     supported (presently Windows 95, Windows 98, Linux and HP-UX
     V10.20) attempting to run these will result in an Unsatisifed-
     LinkError referring to the library mqjbnd01.

     To correct this, follow these steps:

        1. Ensure your Queue Manager is set up to accept client
           connections. Ensure the listener is running.

        2. Set up the MQ JMS administration tool as described in
           chapter 5 of MQSeries Using Java. You will need to edit
           the file JMSAdmin.config to supply details of your LDAP
           server.

        3. Run IVTSetup to create the JNDI objects.

        4. Run JMSAdmin, and from the prompt, type:
           (The '+' denotes the following statement can be placed on
            the same line as the preceding one)

            alter qcf(ivtQCF) tran(CLIENT) host(yourhost) +
                  port(yourport) chan(yourchan) qmgr(yourqmgr)

            alter q(ivtQ) qmgr(yourqmgr)

            alter tcf(ivtTCF) tran(CLIENT) host(yourhost) +
                  port(yourport) chan(yourchan) qmgr(yourqmgr)+
                  bqm(yourqmgr)

            end

           Replace yourhost, yourport, yourchan, and yourqmgr
           with appropriate values. You may omit port(yourport) and
           chan(yourchan) if your Queue Manager is set up to use
           the default port of 1414 and default channel of
           SYSTEM.DEF.SVRCONN.

        5. This JNDI setup will allow you to run the IVT against your
           queue manager:

            IVTRun -url "providerURL" -icf initCtxFact

            See Chapter 4 of MQSeries Using Java for more information
            about IVTRun. providerURL and initCtxFact should
            match the values you supplied in step 2.

        6. PTPSample01.java will use JNDI defintions created above.
           To run it, type:

            javac PTPSample01.java
            java PTPSample01 -url "providerURL" -icf initCtxFact

        7. PTPSample02.java requires the ICF and URL to be edited
           into the program. Alter lines 42 and 43 appropriately - as
           instructed in the comments at the start of the program -
           and then type:

            javac PTPSample02.java
            java PTPSample02

        8. PTPSample03.java needs the following lines added after
           factory.setQueueManager(QMGR); on line 100:

            factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
            factory.setHostName(yourhost);
            factory.setPort(yourport);
            factory.setChannel(yourchan);
            factory.setBrokerQueueManager(yourqmgr);

           Then compile and run the sample with:

            javac PTPSample03.java
            java PTPSample03

        9. JMSPubSub.java requires certain objects to be set up in
           your JNDI namespace. Run JMSAdmin and, from the prompt,
           type:

            define tcf(PubSub.TCF) tran(CLIENT) host(yourhost) +
                   port(yourport) chan(yourchan) +
                   qmgr(yourqmgr) bqm(yourqmgr)

            define t(PubSub.T) topic(MQJMS/Samples/PubSub)

            end

           Edit lines 80 and 81 of JMSPubSub.java to reflect your
           ICF and URL. Compile and run the program:

            javac JMSPubSub.java
            java JMSPubSub


        10. MQSample.java is set up to use a client connection. Edit
            lines 27, 28 and 31 to describe your system, and compile
            the sample with:

             javac MQSample.java

            Then use the supplied html file to view the applet:

             appletviewer mqsample.html
Whoa thats quite a dump there :). But see the IVT setup is used to create objects that will be used to verify the JMS Setup of MQ SEries, the program you tried to run MQIVP verifies your MQ Base setup only (i.e. doesn't verify whether JMS has been setup -a different story altogether).

Dawn I've tried starting my Q manager from the command line (D:\>), but with the following result--- (these are services that should all be running for a Q manager)

My Q manager starts
My Q manager Command server starts
My Channel initiator stubbornly refuses to start
My Listener starts

.

But if i try to start this from the MQ Series console it starts all my services. Please try to start your Q manager like so...use MQ Series explorer ....Start Button>>Programs>>IBM MQSeries>> MQ Series Explorer

try this out and lemm e know
I've restarted my server machine and did as you've said. I've also close the ms-dos window in client machine and re-execute all the codes again. The error is still there.

C:\Program Files\MQSeries Client\bin>amqsputc outfile.out infile.in QM1 QUEUE1
Sample AMQSPUT0 start
MQCONN ended with reason code 2059
Sorry Dawn, I am stumped now :( .. tell you what I will try if i can duplicate your error, if am lucky I will let u know, sorry couldn't be of more help. But at the moment i am blank....

regards gtloafer
gtloafer,

nvm, I'm trying to read up more to find what I've lacked .. thanks for all your help along my way ...
mm.. can I wait till I solve this problem to hand you the points? Thanks for the process of helping me along the way ..
Why do you want to give me points I didn't get you a solution :-). Anyways the points are just a side attraction, I mainly help people cause, one tends to learn something new along the way, not to mention you get to reach out and meet someone new :-). So don't worry about the points ;-)


regards gtloafer

hi gtloafer,

Today's a nice, sunny day :)

I've finally executed the java MQIVP !

C:\Program Files\MQSeries Client\bin>java MQIVP
MQSeries for Java Installation Verification Program
5639-B43 (C) Copyright IBM Corp. 1997, 1998. All Rights Reserved.
===========================================================

Please enter the type of connection (MQSeries or VisiBroker)  : (MQSeries)
Please enter the IP address of the MQSeries server            :130.66.13.95
Please enter the port to connect to                           : (1414)
Please enter the server connection channel name               :CHANNEL1
Please enter the queue manager name                           :queue.manager.1
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 MQSeries Transport is functioning correctly.
Press Enter to continue ...

================================================================

what I did:
followed amqtac02.pdf docu in MQSeries v5.2 under chapter 7: verifying client installation.
I've set up Server and Client again.

I've followed a more updated version of Setting up the server.

Setting up the MQSeries client:
http://www-4.ibm.com/software/ts/mqseries/library/manualsa/csqzaf/csqzaf1h.htm
Way to go !!! Congratulations on getting your MQ running
:-). I wish you all the best on exploring MQ and getting the most out of it ...

Cheers gtloafer
 
Thanks a lot, gtloafer :)

hi gtloafer,

May I ask you this question?

Do I need "Visual Age for Java" program to create and run a Java program that is similar to MQIVP to test client and server message sending? Or JDK 1.2 and MS-DOS are the only 2 things that I need? Can the Java program that I create also be referred as a Java Message Service Application?

thanks ..

Dawn.
ASKER CERTIFIED SOLUTION
Avatar of gtloafer
gtloafer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your guidance along my way.

Dawn.
Just to say thanks Dawn :-)

regards gtloafer

PS Hows it going with MQ Series and Java ?
welcome ... :) it's still going on ..