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 » General IBM MQ Support » Unable to connect to MQ in client mode using Dotnet

Post new topic  Reply to topic
 Unable to connect to MQ in client mode using Dotnet « View previous topic :: View next topic » 
Author Message
Aman_05
PostPosted: Wed Jun 12, 2019 8:37 am    Post subject: Unable to connect to MQ in client mode using Dotnet Reply with quote

Newbie

Joined: 12 Jun 2019
Posts: 3

Hi All,

Receiving below error while executing command ,could someone please help on the same ,using mqserver variable and i am able to connect to queue manager via amqsputc without issues but receiving 2059 with dotnet command.



SimplePut.exe -q LCP.INITIATE -k *SYSTEM -s TLS_RSA_WITH_AES_256_CBC_SHA256 -h testsvr -l CH.LLY.LCP.DMQMC005 -p 1420


00000117 10:35:17.234510 7808.1 : Constructing IBM.WMQ.Nmqi.NmqiEnvironment#0378734A MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/NmqiEnvironment.cs
00000118 10:35:17.249629 7808.1 : Constructing IBM.WMQ.MQClientCfg#02004EEE MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/NmqiObject.cs
00000119 10:35:17.249711 7808.1 : Constructing IBM.WMQ.MQClientCfg#02004EEE MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQIniFile.cs
0000011A 10:35:17.249731 7808.1 : Constructing IBM.WMQ.MQClientCfg#02004EEE MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQClientCfg.cs

000001AE 10:35:17.298328 7808.1 : Constructing IBM.WMQ.MQQueueManager#0218F99C MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/baseclasses/MQManagedObject.cs
000001AF 10:35:17.298361 7808.1 : Constructing IBM.WMQ.MQQueueManager#0218F99C MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/baseclasses/MQQueueManager.cs

000001B0 10:35:17.343949 7808.1 : ---{ MQQueueManager.Connect()
000001B1 10:35:17.345582 7808.1 : SCCSID: '@(#) MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/baseclasses/MQQueueManager.cs'
000001B2 10:35:17.346946 7808.1 : MQQueueManager.IsConnected False HConn: (null)
000001B3 10:35:17.346978 7808.1 : ConnectOptions: QMgr = '', ConnName = '', Channel = ''
000001B4 10:35:17.349374 7808.1 : -----{ MQQueueManager.OverrideConnectionProperties()
000001B5 10:35:17.352662 7808.1 : ------{ xcsGetEnvironmentString
000001B6 10:35:17.352702 7808.1 : xcsGetEnvironmentString[overrideConnectionDetails] = NULL
000001B7 10:35:17.352715 7808.1 : ------}! xcsGetEnvironmentString (rc=xecE_E_ENV_VAR_NOT_FOUND)
000001B8 10:35:17.352748 7808.1 : ----} MQQueueManager.OverrideConnectionProperties() (rc=OK)
000001B9 10:35:17.354690 7808.1 : Connection Name: testsvr(1420)
000001BA 10:35:17.354716 7808.1 : Channel: CH.LLY.LCP.DMQMC005
000001BB 10:35:17.354733 7808.1 : SSLCipherSpec: TLS_RSA_WITH_AES_128_SHA
000001BC 10:35:17.354762 7808.1 : SSLKeyRepository: *SYSTEM
000001BD 10:35:17.354811 7808.1 : MQCNO.options: 0x00000040
000001BE 10:35:17.356428 7808.1 : BindingType from property (MQSeries Managed Client)
000001BF 10:35:17.356458 7808.1 : BindingType = 'MANAGEDCLIENT' connectionType = 6
000001C0 10:35:17.359684 7808.1 : -----{ NmqiEnvironment.GetMQI(int)
000001C1 10:35:17.360569 7808.1 : Component ID Supplied -> 2
000001C2 10:35:17.360585 7808.1 : Component Name -> IBM.WMQ.Nmqi.MQFAP
000001C3 10:35:17.370326 7808.1 : Constructing IBM.WMQ.MQCommsBufferPool#02E0C681 MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQCommsBufferPool.cs
000001C4 10:35:17.371123 7808.1 : Constructing IBM.WMQ.MQCommsBufferImpl#01E6FA8E MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQCommsBufferImpl.cs

00000221 10:35:17.420724 7808.1 : Constructing IBM.WMQ.MQSSLConfigOptions#0232467A MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQSslConfigOptions.cs
00000222 10:35:17.422993 7808.1 : Constructing IBM.WMQ.Nmqi.NmqiStructureFormatter#03C47A4F MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/NmqiStructureFormatter.cs


00000339 10:35:17.841256 7808.1 : Constructing IBM.WMQ.MQERD#0189441B MQMBID sn=p800-004-151017 su=_KvDdkHSxEeW7tayg2YKGHQ pn=lib/dotnet/pc/winnt/nmqi/MQERD.cs
0000033A 10:35:17.842062 7808.1 : -------------------------{ MQERD.ReadStruct(Byte [ ],int)
0000033B 10:35:17.843354 7808.1 : ------------------------} MQERD.ReadStruct(Byte [ ],int) (rc=OK)
0000033C 10:35:17.844348 7808.1 : -------------------------{ MQERD.GetReasonCode()
0000033D 10:35:17.846599 7808.1 : ------------------------} MQERD.GetReasonCode() (rc=OK)
0000033E 10:35:17.850055 7808.1 : New MQException CompCode: 2 Reason: 2059
0000033F 10:35:17.850085 7808.1 : New NmqiException CompCode: 2 Reason: 2059
00000340 10:35:17.850173 7808.1 : ----------------------} MQFAPConnection.AnalyseErrorSegment(MQTSH) (rc=OK)
00000341 10:35:17.850190 7808.1 : --------------------} MQFAPConnection.ReceiveTSH(MQTSH) (rc=OK)
00000342 10:35:17.850957 7808.1 : Exception received
IBM.WMQ.Nmqi.NmqiException
Message: MQRC_Q_MGR_NOT_AVAILABLE
StackTrace:
at IBM.WMQ.Nmqi.MQFAPConnection.AnalyseErrorSegment(MQTSH rTSH)
at IBM.WMQ.Nmqi.MQFAPConnection.ReceiveTSH(MQTSH rTSHP)
at IBM.WMQ.Nmqi.MQFAPConnection.InitialiseSession()
00000343 10:35:17.851069 7808.1 : ------------------} MQFAPConnection.InitialiseSession() (rc=OK)
00000344 10:35:17.851186 7808.1 : Exception received
IBM.WMQ.Nmqi.NmqiException
Message: MQRC_Q_MGR_NOT_AVAILABLE
StackTrace:
at IBM.WMQ.Nmqi.MQFAPConnection.InitialiseSession()
at IBM.WMQ.Nmqi.MQFAPConnection.Connect(MQConnectionSecurityParameters securityParms)

Also tried adding below in mqclient.ini

ServerConnectionParms=CH.LLY.LCP.DMQMC005/TCP/testsvr(1420)


Last edited by Aman_05 on Wed Jun 12, 2019 8:42 am; edited 1 time in total
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Jun 12, 2019 8:41 am    Post subject: Re: Unable to connect to MQ in client mode using Dotnet Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Aman_05 wrote:
...using mqserver variable and i am able to connect to queue manager via amqsputc without issues but receiving 2059 with dotnet command.

SimplePut.exe -q LCP.INITIATE -k *SYSTEM -s TLS_RSA_WITH_AES_256_CBC_SHA256 -h testsvr -l CH.LLY.LCP.DMQMC005 -p 1420

First mistake highlighted above. I suggest you read the Knowledge Centre (KC) in regard to TLS and use of the MQSERVER variable.

Aman_05 wrote:
...Also tried adding below in mqclient.ini...

Second mistake. Again, read the KC in regard to the precedence of MQSERVER, other related variables, and an mqclient.ini file.
_________________
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.


Last edited by exerk on Wed Jun 12, 2019 8:43 am; edited 1 time in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 12, 2019 8:43 am    Post subject: Re: Unable to connect to MQ in client mode using Dotnet Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Aman_05 wrote:
Receiving below error while executing command ,could someone please help on the same ,using mqserver variable and i am able to connect to queue manager via amqsputc without issues but receiving 2059 with dotnet command.


There are any number of reasons for a 2059 error and they've all been discussed in this forum at one time or another. You'll find a search box at the top right of this page.

Do not lose sight of the fact that you can get a 2059 from environmental problems. There could be nothing wrong with your code or your configuration.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
hughson
PostPosted: Wed Jun 12, 2019 2:39 pm    Post subject: Re: Unable to connect to MQ in client mode using Dotnet Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

I don't think you will pick up the MQSERVER environment variable or the string you put in mqclient.ini with ServerConnectionParms because you have specifed all the parameters on the invocation of the program, and this will over-ride all those other ways.

When using SSL with a managed .NET client as you are doing, remember that the SSLCipherSpec names might be different, although TLS_RSA_WITH_AES_256_CBC_SHA256 is one of the very few that has the same name in MQ as in .NET (see CipherSpec mappings for the managed .NET client).

You provided the following parms:

Aman_05 wrote:
SimplePut.exe -q LCP.INITIATE -k *SYSTEM -s TLS_RSA_WITH_AES_256_CBC_SHA256 -h testsvr -l CH.LLY.LCP.DMQMC005 -p 1420


but when you look at the output you provided to us, the SSLCipherSpec that it is using is different, which would result in a failure to complete the handshake because it wouldn't match the other end.

Aman_05 wrote:
000001B9 10:35:17.354690 7808.1 : Connection Name: testsvr(1420)
000001BA 10:35:17.354716 7808.1 : Channel: CH.LLY.LCP.DMQMC005
000001BB 10:35:17.354733 7808.1 : SSLCipherSpec: TLS_RSA_WITH_AES_128_SHA
000001BC 10:35:17.354762 7808.1 : SSLKeyRepository: *SYSTEM
000001BD 10:35:17.354811 7808.1 : MQCNO.options: 0x00000040
000001BE 10:35:17.356428 7808.1 : BindingType from property (MQSeries Managed Client)
000001BF 10:35:17.356458 7808.1 : BindingType = 'MANAGEDCLIENT' connectionType = 6
000001C0 10:35:17.359684 7808.1 : -----{ NmqiEnvironment.GetMQI(int)
000001C1 10:35:17.360569 7808.1 : Component ID Supplied -> 2
000001C2 10:35:17.360585 7808.1 : Component Name -> IBM.WMQ.Nmqi.MQFAP


Oddly, "TLS_RSA_WITH_AES_128_SHA" is not a cipher spec in either MQ or .NET, so I don't know what is going on there, but it's an area to investigate.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Aman_05
PostPosted: Thu Jun 13, 2019 3:27 am    Post subject: Reply with quote

Newbie

Joined: 12 Jun 2019
Posts: 3

Thanks for the inputs Morag, vitor and exerk

just used the MQserver or mqclient file variables to check the connectivity to queue manager if i use simple amqsputc to check connectivity.

i was aware of mqserver precedence over mqclient files values but wasn't quite aware of that the other sample programs while directly passes the arguments takes precedence over MQSERVER variable.

@Morag :
I am not sure if the command needs some variables to be defined as same setup is working on different machine, already comparing variables on both servers

E:\Program Files\IBM\WebSphere MQ\Tools\dotnet\samples\cs\base\bin>Simpleput -q LCP.INITIATE -k *SYSTEM -s TLS_RSA_WITH_AES_256_CBC_SHA256 -h testsvr -p 1420 -l CH.LLY.LCP.DMQMC005
Start of SimplePut Application

MQ Parameters
1) queueName = LCP.INITIATE
2) keyRepository = *SYSTEM
3) cipherSpec = TLS_RSA_WITH_AES_256_CBC_SHA256
4) host = testsvr
5) port = 1420
6) channel = CH.LLY.LCP.DMQMC005
7) numberOfMsgs = 1
sslPeerName =
9) keyResetCount = 0
10) sslCertRevocationCheck = False

Connecting to queue manager..
MQException caught: 2538 - MQRC_HOST_NOT_AVAILABLE
at IBM.WMQ.MQQueueManager.Connect(String queueManagerName)
at SimplePut.SimplePut.PutMessages()

End of SimplePut Application
Back to top
View user's profile Send private message
exerk
PostPosted: Thu Jun 13, 2019 3:29 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Check the queue manager logs for any entries, although this has the suspicious smell of a firewall in the way...
_________________
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
View user's profile Send private message
hughson
PostPosted: Thu Jun 13, 2019 2:36 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Aman_05 wrote:
Connecting to queue manager..
MQException caught: 2538 - MQRC_HOST_NOT_AVAILABLE
at IBM.WMQ.MQQueueManager.Connect(String queueManagerName)
at SimplePut.SimplePut.PutMessages()

End of SimplePut Application


Interestingly, your symptoms appear to have changed. To start with you were receiving a 2059 (MQRC_Q_MGR_NOT_AVAILABLE) but now you are getting a 2538 (MQRC_HOST_NOT_AVAILABLE).

Can you check that the listener is running on your machine at testsvr and that it is definitely using post 1420.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Aman_05
PostPosted: Fri Jun 21, 2019 4:58 pm    Post subject: Reply with quote

Newbie

Joined: 12 Jun 2019
Posts: 3

Hi Exerk,Morag,

After some testing done at our end, it was identified that application team was using incorrect certificate details and caused 2538 ,failing the ssl handshake.

The same was identified when we tested the connection with another channel with empty values for sslciph

Thansk again for your inputs.[/quote]
Back to top
View user's profile Send private message
hughson
PostPosted: Fri Jun 21, 2019 7:24 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Aman_05 wrote:
Hi Exerk,Morag,

After some testing done at our end, it was identified that application team was using incorrect certificate details and caused 2538 ,failing the ssl handshake.

The same was identified when we tested the connection with another channel with empty values for sslciph

Thansk again for your inputs.

Well that is very interesting. You should report his to IBM. A client connection which fails a handshake should not be returning an MQRC of 2538 (MQRC_HOST_NOT_AVAILABLE), it should be reporting something like MQRC_SSL_INITIALIZATION_ERROR (2393) or one of the other MQRC_SSL_* reason codes (depending on the reason the handshake failed). That would have sped up your diagnosis of the problem if it had pointed you in the right direction!!

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
PeterPotkay
PostPosted: Sat Jun 22, 2019 4:36 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7717

Perhaps the version of MQ in use predates the more helpful MQRC_SSL* Reason Codes.
_________________
Peter Potkay
Keep Calm and MQ On
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 » General IBM MQ Support » Unable to connect to MQ in client mode using Dotnet
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.