Author |
Message
|
coolbeans |
Posted: Fri Jul 16, 2004 5:38 am Post subject: Newbie Question - how do I find out what channel/port no? |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
Sorry for this newbie question.
I have managed to get this working if I comment out the MQEnviorment variables (therefore running it locally), but I need to be able to run this connecting to another machine which is running WebSphere. I know I have got the correct hostname because if I change the hostname it throws an exception saying invaild hostname.
So, that must mean that the channel name and/or port number are wrong, so how do I find out what channel and port number I am using?
Thanks in advance.
The code throws the following exception:
Code: |
[color=red]com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused[/color] |
Code: |
public void myMethod()
{
try
{
InetAddress inet_address = InetAddress.getByName(/*My IP Address*/);
// get the host name from the ip address
MQEnvironment.hostname = inet_address.getHostName();
MQEnvironment.channel ="JAVA.CHANNEL";
MQEnvironment.port = 9043;
// create the queue manager
MQQueueManager qMgr = new MQQueueManager(qManager);
System.out.println(" --> Success: Queue manager created!");
}
catch(MQException ex)
{
ex.printStackTrace();
try
{
if(qMgr != null)
{
//Disconnect from the queue manager
qMgr.disconnect();
}
}
catch(MQException e)
{
e.printStackTrace();
}
}
catch ( UnknownHostException e )
{
e.printStackTrace();
}
} |
[/code] |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 16, 2004 7:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
While there may be ways to discover the correct port and channel information remotely, you should simply ask your MQ Administrator.
Or tell us why you can't. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 7:24 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
I am the MQ administrator! I have installed Websphere MQ on my machine have created a couple of queues and have started the server.
I have the code working fine when I dont set the MQEnviroment settings (i.e. it is running in "bind" mode), but I need to get it working so that I can run the code on a different machine to connect to my instance of websphere.
thanks in advance. |
|
Back to top |
|
 |
vennela |
Posted: Fri Jul 16, 2004 7:35 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Is the listener for that particular QMGR running on the port 9043? |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 7:38 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
I don't know... How do you tell?
The only way I was able to tell what the name of the queue manager was, was because theres a directory under the websphere install called "qmgrs", and then another directory there which was the queue manager. The Websphere Admin Help has been no help!
thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 16, 2004 7:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay.
You're a newbie MQ Admin, not a newbie MQ Programmer.
You can find out what port your listener is listening to using netstat.
You can find out what channels you have defined by using runmqsc. type in runmqsc, and then at the next prompt type in "display channel(*)"
You want to use Server Connection channels (svrconn) for clients to connect to.
There should (if you instructed it to create the default objects) be a SYSTEM.DEF.SVRCONN you can use.
What operating system are you running? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 7:59 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
I'm newbie MQ Admin and a newbie MQ Programmer!
I've managed to get to grips with the MQ programming so far today, and have messages going on to and comming off of the queue, but its just this final stumbling block of getting my app to connect "remotely" (all be it whilst in development I run MQ and my app on the same machine).
I had a look at netstats earlier but it lists about 50 different ports on which I'm listening, It doesn't say which is for MQ?
runmqsc is listing my channels - great! And I have "SYSTEM.DEF.SVRCONN". So that just leaves the port number?
I'm running XP.
cheers. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Jul 16, 2004 8:05 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
The Queue Manager is on XP?
That makes it easy! Just open MQServices from Start Programs, and look at the properties of the listener under your QM. It will tell you what port it is using. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 8:13 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
I don't think I have MQServices.
I think that all that is installed is Websphere MQ.
cheers. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Jul 16, 2004 8:14 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Where is the QM running? On the XP box? _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 8:15 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
Yeah. The same machine as I'm developing on. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Jul 16, 2004 8:27 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
On Windows, when you install MQ, you get the Services component as well. Look at Start...Programs....IBM WebSphere MQ... Websphere MQ Services.
open it, expand the tree till you find your QM, expand that tree till you find your listener, and check out its properties.
You should be starting and stopping MQ thru this GUI when on Windows. Or using the amqmdain (sp?) commands from the command line. Do not mix in the standard strmqm, runmqlsr, endmqlsr, etc commands or you will have a big mess. Just define MQ as a service to windows, and then in this MQ Services GUI, decide what comes up automatically by selecting manual or automatic.
If you did start the listener from the command line (runmqlsr) it may not show up in the GUI, not sure. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
coolbeans |
Posted: Fri Jul 16, 2004 8:37 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
When we installed MQ we just installed the bare bones to get it running, All I have is Start > Programs > IBM WebSphere > Application Server > ...
All I have available at the moment is the WebSphere installer, so I'll try installing it again and see if theres any other components I can install. Is it possible to find the port number from any of the command line programs such as strmqm/runmqlsr/endmqlsr?
Its the end of the day here so appologies if I dont respond till Monday.
thanks again.
 |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jul 16, 2004 8:39 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, if you're running on Windows, as Peter says things are a little easier.
First off, there's the Windows WebSphere MQ Explorer, which will show you your channels as well. You may have to tell it to Show System Objects to see SYSTEM.DEF.SVRCONN. This is in your program menu under WebSphere MQ.
Second, there are lots of ways to get to MQServices. One, there should be a task bar icon for MQ (with an upward pointing green arrow). If you right-click on that, there's an option for MQServices.
Second, as Peter said, there is WebSphere MQ Services in your program menu.
THIRD, you can select your queue manager in WebSphere MQ Explorer, right click and go to Services from that menu. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
coolbeans |
Posted: Mon Jul 19, 2004 12:29 am Post subject: |
|
|
 Novice
Joined: 16 Jul 2004 Posts: 20 Location: London, UK
|
I think I have found the problem. I have the evaluation copy of websphere mq, which could be why I don't have MQ Explorer installed? Or does it install as part of the client pacakge?
thanks. |
|
Back to top |
|
 |
|