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 » dotNet "Error in Application" Exception

Post new topic  Reply to topic
 dotNet "Error in Application" Exception « View previous topic :: View next topic » 
Author Message
BruceVanSittert
PostPosted: Tue Mar 27, 2007 8:41 pm    Post subject: dotNet "Error in Application" Exception Reply with quote

Newbie

Joined: 27 Mar 2007
Posts: 5
Location: South Africa

Hi,

I'm getting a little frustrated here so if anyone can assist I would appreciate it...
I'm trying to read messages from a Websphere MQ Queue manager, this is the first time I am using MQ. I am using .Net and from the samples I've seen it should be simple.

I can Initialise the Queue Manager with no problem and I can call Access Queue to get the queue no problem. When I call Get on the Queue I get an Error in the Application Eception with a null inner exception. What I have noticed however is that if I add a watch on the Queue I can see that after I called AccessQueue all the properties on the Queue object throw the exception. So the AccessQueue method probably didn't work as expected...

I've tried messing with the names of the host etc but no matter how I do it I still get the same error...

Please help....


Code:
int iPort = int.Parse(tbPort.Text); //1414
string sChannel = tbChannel.Text; //SYSTEM.ADMIN.SVRCONN
string sQueueManager = tbQueueManager.Text; //MLKDEV00AQMGR
string sQueueName = tbQueueName.Text; //DOT.NET.TESTING.Q.A
string sHostName = tbHost.Text + "(" + iPort.ToString() + ")"; //tbHost.Text = s036mlk104003

try
{
MQQueueManager oManager = new MQQueueManager(sQueueManager, sChannel, sHostName);
MQQueue oQueue = oManager.AccessQueue(sQueueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);

MQMessage oMessage = null;
MQGetMessageOptions oOpts = new MQGetMessageOptions();
oOpts.WaitInterval = 2000;
oOpts.Options |= MQC.MQGMO_WAIT;

oQueue.Get(oMessage, oOpts);
}
catch (MQException ex)
{
MessageBox.Show(ex.Message);
}
Back to top
View user's profile Send private message
BruceVanSittert
PostPosted: Tue Mar 27, 2007 9:25 pm    Post subject: Reply with quote

Newbie

Joined: 27 Mar 2007
Posts: 5
Location: South Africa

Ok,

So if any other fool, like me, comes along with the same error, the problem is:

MQMessage oMessage = null;

it should be:
MQMessage oMessage = new MQMessage();

I can't believe I could be so silly...
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Tue Mar 27, 2007 10:25 pm    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

BruceVanSittert wrote:

I can't believe I could be so silly...

so you are human... what is the problem
_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
BruceVanSittert
PostPosted: Tue Mar 27, 2007 11:51 pm    Post subject: Reply with quote

Newbie

Joined: 27 Mar 2007
Posts: 5
Location: South Africa

I guess so,
The embarrasing part is that I did the same thing last week as a proof of concept to a Queue on my local PC and that time I did it right...

Thanx anyway...
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Mar 28, 2007 12:11 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Use MQGMO_CONVERT to make the application process (MQSTR) messages from any platform (this is future proofing).
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 28, 2007 12:26 am    Post subject: Reply with quote

Grand High Poobah

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

BruceVanSittert wrote:

I can't believe I could be so silly...


Believe it.

I've seen silly mistakes.

I've MADE sillier mistakes.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
HubertKleinmanns
PostPosted: Thu Mar 29, 2007 2:35 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

Vitor wrote:
BruceVanSittert wrote:

I can't believe I could be so silly...


Believe it.

I've seen silly mistakes.

I've MADE sillier mistakes.


A wise guy (Lenin) said:

Quote:
Who works, makes mistakes. Who does not make mistakes, does not work.

_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
BruceVanSittert
PostPosted: Thu Mar 29, 2007 2:59 am    Post subject: Reply with quote

Newbie

Joined: 27 Mar 2007
Posts: 5
Location: South Africa

Quote:
Who works, makes mistakes. Who does not make mistakes, does not work.


I must be working really hard then...
Back to top
View user's profile Send private message
BruceVanSittert
PostPosted: Thu Mar 29, 2007 5:56 am    Post subject: Reply with quote

Newbie

Joined: 27 Mar 2007
Posts: 5
Location: South Africa

Ok,
Next Question.

In dotNet, if I call Get on the Queue and there are no messages on the Queue, I get an Error: "Error in the Application".

I can't really handle this because this error could mean anything. I've tried searching through the properties on the Queue object to find something that could help but every property just throws: "Error in the Application".

How do I determine that there are no messages in the queue without just assuming that if I get that error on that line it is because there are no Messages?

Thanx,
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 29, 2007 6:21 am    Post subject: Reply with quote

Grand High Poobah

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

BruceVanSittert wrote:

How do I determine that there are no messages in the queue without just assuming that if I get that error on that line it is because there are no Messages?


You need to extract the MQ reason code from the exception. There are a raft of different codes (listed in the Application Programming Reference) that detail exactly what caused the problem.

As a starter, 2033 is the code for no messages on queue. Be aware that strictly it means "no matching messages on queue", so be careful if you're using any match options at some future point.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » dotNet "Error in Application" Exception
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.