Author |
Message
|
firelior |
Posted: Sun Jun 10, 2012 1:03 am Post subject: Configuring mq websphere 7 with .net |
|
|
Apprentice
Joined: 31 May 2012 Posts: 28
|
Hi,
I am trying to connect to a remote queue using c#.
I tried many ways to connect to the remote queue but it always fails with common errors like:
MQRC_CHANNEL_CONFIG_ERROR
or
MQRC_HOST_NOT_AVAILABLE
What I am doing is this:
Code: |
string channel = "QM_TEST.SVRCONN";
string hostname = "<serverIp>";
string queueName = "QM_TEST";
string port = 1414;
props.Add(MQC.HOST_NAME_PROPERTY, hostname);
props.Add(MQC.CHANNEL_PROPERTY, channel);
props.Add(MQC.PORT_PROPERTY, port );
props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
MQQueue mqQueue = new MQQueueManager(queueName, props);
|
I have tryed changing this but all failed.
I think that my problem is the server configurations..
can you point me to a full guide to how to configure a server and connect to it with .net?
My problem is connecting to a REMOTE server using .net and not to a local server.
SOLVED
There was a difference with CCSID.
And a bug in .net adapter.
When I put this:
Code: |
ConnectionProperties.Add(MQC.CCSID_PROPERTY, MQC.CODESET_UTF);
|
It still didn't work.
But when I put this:
Code: |
Environment.SetEnvironmentVariable("MQCCSID", "1208");
|
It works
thank you![/u][/i]
Last edited by firelior on Tue Jul 03, 2012 4:51 am; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Jun 10, 2012 2:47 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The document you're looking for is http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/index.jsp
It's a full guide to how to accomplish your task. And every other task with MQ.
But you're guessing, rather than making a reasonable attempt to troubleshoot your problem.
The first thing to do is to make sure that the hostname, channel name and port # you have are correct. They must match the queue manager.
Once you know that you have the correct information, you can troubleshoot each individual MQRC as it comes up. Start by reading the meaning of the MQRC, then think about what it says. Then look at the qmgr error logs to see if there's anything else. |
|
Back to top |
|
 |
firelior |
Posted: Sun Jun 10, 2012 4:22 am Post subject: |
|
|
Apprentice
Joined: 31 May 2012 Posts: 28
|
Hi,
I did read it.
I even did exactly as stated here:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r1/index.jsp
And I still get this error:
MQRC_CHANNEL_CONFIG_ERROR
which means:
1.The server and client cannot agree on the channel attributes to use.
whats the channel attributes that it should agree on?
2.There are errors in one or both of the QM.INI or MQCLIENT.INI configuration files.
Why should there be?
3.The server machine does not support the code page used by the client.
I tryed using .net and amq console. |
|
Back to top |
|
 |
Vitor |
Posted: Sun Jun 10, 2012 7:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
firelior wrote: |
3.The server machine does not support the code page used by the client.
I tryed using .net and amq console. |
Set up the client according to the InfoCenter, test with the amqsputc sample. If that doesn't work, debug.
Use that working configuration to connect your .net client. If that doesn't work, debug.
Transpose that method into a .net table as your code snippet indicates. If that doesn't work, debug. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
exerk |
Posted: Sun Jun 10, 2012 7:35 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Vitor wrote: |
Transpose that method into a .net table as your code snippet indicates. If that doesn't work, debug. |
Much easier to use the mqclient.ini file and a CCDT... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jun 10, 2012 11:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Your property table is wrong
Switch the port from a string to an int...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Sun Jun 10, 2012 1:47 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
exerk wrote: |
Vitor wrote: |
Transpose that method into a .net table as your code snippet indicates. If that doesn't work, debug. |
Much easier to use the mqclient.ini file and a CCDT... |
But if the OP has his heart set on a coded table (presumably because he doesn't like his WMQ admin....) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
exerk |
Posted: Sun Jun 10, 2012 2:23 pm Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Vitor wrote: |
exerk wrote: |
Vitor wrote: |
Transpose that method into a .net table as your code snippet indicates. If that doesn't work, debug. |
Much easier to use the mqclient.ini file and a CCDT... |
But if the OP has his heart set on a coded table (presumably because he doesn't like his WMQ admin....) |
True. Sounds like someone of the "...if there's a difficult way of doing things..." fraternity  _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
firelior |
Posted: Sun Jun 10, 2012 11:21 pm Post subject: |
|
|
Apprentice
Joined: 31 May 2012 Posts: 28
|
Hi,
first of all thanks for the help.
Here are some more detail:
My Code:
Code: |
string queueManager = "QM_TEST";
string channel = "QM_TEST.SVRCONN";
string hostname = "192.168.50.54";
string queueName = "QM_TEST.LOCAL.ONE";
int port = 1414;
props.Add(MQC.HOST_NAME_PROPERTY, hostname);
props.Add(MQC.CHANNEL_PROPERTY, channel);
props.Add(MQC.PORT_PROPERTY, port);
props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
MQQueueManager mqQueueManager = new MQQueueManager(queueManager, props);
|
When I use:
TRANSPORT_MQSERIES_MANAGED
It gives me MQRC_HOST_NOT_AVAILABLE Error
When I use:
TRANSPORT_MQSERIES_CLIENT
I get:
MQRC_CHANNEL_CONFIG_ERROR
Here is a print screen of the Queue manager on the remote server:
This is the channel:(I only have - server-connection)
And here is the listener:
The queues are not relevent because it doesn't even get there. it fails in the connection.
I also tryed connecting by putting:
MQSERVER=QM_TEST/TCP/192.168.50.54
In my enviorment variables and connecting via
amqsputc QM_TEST.LOCAL.ONE
This also gives me
This gives me MQRC_CHANNEL_CONFIG_ERROR
More detail:
I have 2 static ips.
One is not connected to the server and one is.
The server is not in any domain.
Also, I checked it on wireshark and I do see traffic between the server and the client when I try to connect.
BTW - When I try to wireshark the traffic between a local client and a local mqmanager I don't see traffic..Does it also listen to tcp? or when its in BINDING mode it connects to the server in another way?
Last edited by firelior on Sun Jun 10, 2012 11:54 pm; edited 1 time in total |
|
Back to top |
|
 |
exerk |
Posted: Sun Jun 10, 2012 11:53 pm Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Please post your channel definitions because I note that your queue manager is complaining about the stash file for its key repository.
A snippet of code from a couple of years ago when I was 'playing' with .Net:
Code: |
'*
'* Try to create an MQQueueManager instance
'*
Try
Dim connProp As New Hashtable
connProp.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT)
connProp.Add(MQC.HOST_NAME_PROPERTY, connHost)
connProp.Add(MQC.PORT_PROPERTY, connPort)
connProp.Add(MQC.CHANNEL_PROPERTY, connChannel)
connProp.Add(MQC.SSL_CIPHER_SPEC_PROPERTY, connSSL)
mqQMgr = New MQQueueManager(qmgrName, connProp)
Catch mqe As IBM.WMQ.MQException
'* stop if failed
System.Console.WriteLine("Connection to Queue Manager {0} failed with {1}", qmgrName, mqe.ToString())
Return (mqe.Reason)
End Try |
Note that if you are using SSL in the channel, or planning to do so, you can't use a managed connection. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
firelior |
Posted: Mon Jun 11, 2012 12:07 am Post subject: |
|
|
Apprentice
Joined: 31 May 2012 Posts: 28
|
Hi,
No I am not using SSL.
I looked at the queue manager error log and here is what it says:
Code: |
AMQ9575: DCE Security: failed to get the user's login name.
EXPLANATION:
System call 192.168.50.55 to get the login name of the user running WebSphere
MQ client application process 5 failed with error value -1. This occurred in
security exit function create_cred. The exit will now attempt to open channel
using the DCE default login context.
ACTION:
If you wish to run using the DCE default login context take no action. If you
wish to run using the user's login name as the DCE security exit principal
examine the documentation for the operating system on which you are running MQ
clients and reconfigure the operating system as necessary to allow the
192.168.50.55 call to succeed. |
and then right after that another:
Code: |
AMQ9492: The TCP/IP responder program encountered an error.
EXPLANATION:
The responder program was started but detected an error.
The host name was '192.168.50.55 (192.168.50.55)'; in some cases the host name
cannot be determined and so is shown as '????'.
ACTION:
Look at previous error messages in the error files to determine the error |
The server is not in any domain and it shouldn't be.. |
|
Back to top |
|
 |
exerk |
Posted: Mon Jun 11, 2012 12:21 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Try it un-managed and see what happens... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
firelior |
Posted: Mon Jun 11, 2012 12:56 am Post subject: |
|
|
Apprentice
Joined: 31 May 2012 Posts: 28
|
What do you mean unmanaged? I tryed it with amqsputc. |
|
Back to top |
|
 |
exerk |
Posted: Mon Jun 11, 2012 1:06 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
firelior wrote: |
What do you mean unmanaged? I tryed it with amqsputc. |
.Net connections to WMQ can be managed or unmanaged. You are trying to connect managed, so try it unmanaged and see if you get a different error, or any errors.
firelior wrote: |
I am able to connect with TRANSPORT_MQSERIES_BINDINGS |
Good. That tells you that your code is basically correct.
firelior wrote: |
But I want to connect via TCP/IP. How do I configure the queue manager? |
Well, you have the SVRCONN created, and you have yet to post the definition of it as requested.
firelior wrote: |
I need a Server-Connection right? not a client connection. |
All channels, including SVRCONNs have two ends. In the case of SVRCONNs you can define an explicit CLNTCONN, or you can 'dynamically' create one - so what do you think all that props.Add stuff does?
firelior wrote: |
what else might be wrong? :S |
That's what we're trying to find out! _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
T.Rob |
Posted: Mon Jun 11, 2012 1:42 am Post subject: It's the exit |
|
|
 Acolyte
Joined: 16 Oct 2001 Posts: 56 Location: Charlotte, NC
|
I posted an update to the Stack Overflow question on this. None of the normal WMQ configuration diagnostics apply when it is the exit that is killing the connection attempt. Either drop the exit (alter channel SCYEXIT to be blank) or figure out what the exit needs to work properly.
And to answer your question from earlier in the thread, a bindings mode connection uses shared memory, not network protocols. That is why you don't see this error in bindings mode. _________________ -- T.Rob
Voice/SMS 704-443-TROB (8762)
https://t-rob.net
https://linkedin.com/in/tdotrob
@tdotrob on Twitter |
|
Back to top |
|
 |
|