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 API Support » HCON error

Post new topic  Reply to topic
 HCON error « View previous topic :: View next topic » 
Author Message
Reeti
PostPosted: Wed Apr 16, 2003 6:46 am    Post subject: HCON error Reply with quote

Apprentice

Joined: 11 Jul 2002
Posts: 40

Hi:

I'm having a very peculiar problem. while i'm trying to connect to a queue after opening the queue manager usingt c++ API..then at times it's giving Error Code:2018 i.e HCONN error.

I'm unable to understand why this error is coming at times.. but most of the time it's working fine.

Do u hv any idea as what could be the probable solution to this?

Thanks
Reeti
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 16, 2003 6:51 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The description of Reason Code 2018 in the Messages manual and the description in the Application Programming Reference list several suggested causes for generating an MQRC_HCONN_ERROR.
Back to top
View user's profile Send private message
Reeti
PostPosted: Wed Apr 16, 2003 10:14 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2002
Posts: 40

I've seen those explanations. My problem is the error is not coming conistently, so it's really becoming difficult to find the actual reason.

Can anyone help pls. !!

regds
Reeti
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 16, 2003 10:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So you have determined the following , then:
1) The handle is either not shareable, or no other thread is issuing an MQDISC without notifying all other threads
2) The handle is not shareable, and is only used by one thread
3) The parameter pointers are valid, and do not point to read-only memory
4) You are not in an MTS enviornment, or you are not passing the handle between processes or packages
5) The value contained in the handle was actually returned by an MQCONN or MQCONNX call.

Can you describe the behavior of your application better? Is it a single threaded application? Multiple threads? Are you sharing the handle? Are you using some sort of connection pooling mechanism?
Back to top
View user's profile Send private message
JimmyJ
PostPosted: Thu Apr 17, 2003 2:07 pm    Post subject: Reply with quote

Newbie

Joined: 17 Apr 2003
Posts: 2

Jeff.

I am running into the same problem. I am using the WebSphere MQ classes for Microsoft .NET from IBM and was hoping to do connection pooling using COM+.

I set my queueManager and queue objects at the class constructor and that works fine. But when I call my PutMessage method, I run into 2018 error.

Any thoughts on how I can can workaround this?

Thanks.

Jimmy
Back to top
View user's profile Send private message
Reeti
PostPosted: Fri Apr 18, 2003 4:30 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2002
Posts: 40

Hello,
we could overcome the '2018' error posted previously by doing the connection from a newly spawned thread.

under another scenario i'm getting 2045 error while trying to open another queue from different queue manager. my application is a multithreaded one, in the main thread it makes connection with a queue manager (QM) and keep the connection for entire lifecycle. i have spawned a new thread to connect to another queue manager, with the same configuration. from the thread it is possible to open the connection with the new QM but while opening a Q it is giving 2045 error. although it is possible to open the same QM and open a Q from the spawned thread which is also opened by the main thread.

please help!!!

NB: my understanding is that we can open only one queue manager per thread. our requirement is to open multiple QM from same process, thus forced me to go for multi-threaded application environment. please clarify if my above understanding is not right!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 18, 2003 6:44 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Reeti -
So your application is multi-threaded, and you are opening (and possibly closing) the connection in one thread, and using it an another?

Then you might be having issues where sometimes the main thread issues an MQDISC on the HCONN without notifying the other thread that the HCONN is no longer valid.

However, you say you could overcome it by opening the connection in your new thread. That indicates that you are trying to share an HCONN between two threads when the HCONN is not shareable, or is otherwise out of scope in the new thread.

I believe you are still correct that you can only connect to one queue manager per thread, but I'm not positive because I haven't worked with the C API on anything newer than 5.1.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 18, 2003 6:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

JimmyJ -
I don't have any experience working with COM+ or the .NET classes.

The documentation on the 2018 does have some comments about when you can and can't share HCONNs in an MTS (COM+ environment). It's easier for you to read those yourself than it is for me to retype them here. Look in the Application Programming Reference and the Messages Guide.
Back to top
View user's profile Send private message
MichaelR
PostPosted: Mon Apr 21, 2003 6:13 am    Post subject: HCONN error Reply with quote

Apprentice

Joined: 20 May 2002
Posts: 37
Location: Tampa

Reeti,

You can connect to multiple QMgr's from within the same application via the Client Channel Table.

This might resolve your requirements for launching multiple "threads" to communicate with the different QMgr's. This in turn might solve your 2018 problem.

I did have an application experiencing similar inconsistent behavior when spawning multiple threads attempting to share HCONN's. Unfortunately our root cause was because HCONN's were not "threadsafe" on OpenVMS. Indications are you are using Windows but.....

Good luck!!

Back to top
View user's profile Send private message
Reeti
PostPosted: Mon Apr 21, 2003 8:23 am    Post subject: Reply with quote

Apprentice

Joined: 11 Jul 2002
Posts: 40

Hi:

would u pls. enlighten me more on client channel table? an example would be very helpfull.

In my program I have launched two separate threads to connect to two diff queue managers.. but I find it always tries to connect to the first queue manager while attempting the second one. According to the programming ref guide I see there may be some issues with the signal handlers, for which it's behaving in this way.

Can anyone send me some sample code for multi threaded application.

Regds
Reeti
Back to top
View user's profile Send private message
dnaren
PostPosted: Mon May 12, 2003 6:18 am    Post subject: Reply with quote

Apprentice

Joined: 10 Aug 2001
Posts: 45
Location: Charlotte, NC

You can read an article on using client channel definition table here:
http://www.mqtips.com/webspheremq.asp

This article describes various ways to connect to a mq server from a client using MQ API in C++.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
REICESAR
PostPosted: Fri Mar 17, 2006 9:09 am    Post subject: Solved Reply with quote

Newbie

Joined: 17 Mar 2006
Posts: 1

My problem (2018 error) was solved using following article:

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzal.doc/conscp.htm

I used MQCNO_HANDLE_SHARE_BLOCK connect option.

good luck,

Reinaldo
_________________
Reinaldo Guedes
Systems Analyst
Juiz de Fora/MG - Brazil
Back to top
View user's profile Send private message
hguapluas
PostPosted: Thu Oct 26, 2006 1:19 pm    Post subject: Reply with quote

Centurion

Joined: 05 Aug 2004
Posts: 105
Location: San Diego

In case anyone is curious, the url reference by dnaren has changed:

http://www.mqfaq.com/webspheremq.php
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 API Support » HCON error
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.