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 Java / JMS » lost connections on JMSException

Post new topic  Reply to topic
 lost connections on JMSException « View previous topic :: View next topic » 
Author Message
SilentWind
PostPosted: Tue Jun 05, 2007 10:07 pm    Post subject: lost connections on JMSException Reply with quote

Acolyte

Joined: 11 Jan 2006
Posts: 58

Hi,

I have two JMS clients, with the same MQ Java subscriber programs running on these clients.

However when I remove the physical TCP connection (i.e. the LAN,WAN cable), only one of them throws the JMSException while the other does not receive any exceptions.

Why is the other client unable to detect lost connections on JMSException?


Thanks.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Tue Jun 05, 2007 11:00 pm    Post subject: Re: lost connections on JMSException Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

What does this code do ?

Maybe you should debug it ?
Maybe in this code there are some special conditions ?


Let say in your code there is condition - > if there is no message in queue wait 1 hour.


In your queue there is 1 message and 2 instances of your application is trying to do get.

First takes message , second detects no message and waits 1 hour.

Now you break physical TCP connection.

What now ?

First instance will try to do another get and will throw exception.
Second will do nothing because it is still waiting 1 hour.

Maybe it is not a good example but shows that it can happened.

Just debug your code.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
SilentWind
PostPosted: Tue Jun 05, 2007 11:38 pm    Post subject: Re: lost connections on JMSException Reply with quote

Acolyte

Joined: 11 Jan 2006
Posts: 58

marcin.kasinski wrote:
What does this code do ?

Maybe you should debug it ?
Maybe in this code there are some special conditions ?


Let say in your code there is condition - > if there is no message in queue wait 1 hour.


In your queue there is 1 message and 2 instances of your application is trying to do get.

First takes message , second detects no message and waits 1 hour.

Now you break physical TCP connection.

What now ?

First instance will try to do another get and will throw exception.
Second will do nothing because it is still waiting 1 hour.

Maybe it is not a good example but shows that it can happened.

Just debug your code.


Ok, my first question was not clear.

I have an ExceptionListener implemented and hence have a OnJMSException method declared to handle any possible JMS exceptions.

Inside my JMS exception method, I have a reconnect method which establishes all existing subscribers back to the MQ server.

All works fine until I "accidentally" unplug the LAN cable to verify for a lost TCP connection test. For some machines, the OnJMSException is called and the reconnect runs perfectly, while some machines this OnJMSException is not called.

Also, there is nothing to debug because the OnJMSException is not being called at all. No error codes, no linked exception. The client program simply thinks it is still connected. But the messages is not coming in anymore.

Fyi, this is a publish-subscribe client, the messages come in asynchronously. Both clients have the same code and messages are being published continously to the server to be retrieved by these 2 clients.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Jun 06, 2007 12:08 am    Post subject: Re: lost connections on JMSException Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

There is something to debug.

Just check which method is invoked in both application when you break connection.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
SilentWind
PostPosted: Wed Jun 06, 2007 12:20 am    Post subject: Re: lost connections on JMSException Reply with quote

Acolyte

Joined: 11 Jan 2006
Posts: 58

marcin.kasinski wrote:
There is something to debug.

Just check which method is invoked in both application when you break connection.


I have already said when break connection, the OnJMSException method is invoked. And both application have the same code.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Jun 06, 2007 12:31 am    Post subject: Re: lost connections on JMSException Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

SilentWind wrote:
marcin.kasinski wrote:
There is something to debug.

Just check which method is invoked in both application when you break connection.


I have already said when break connection, the OnJMSException method is invoked. And both application have the same code.


But you mentioned that OnJMSException is invoked on one instance and on other not.

Did I miss something ?

SilentWind wrote:

Also, there is nothing to debug because the OnJMSException is not being called at all. No error codes, no linked exception. The client program simply thinks it is still connected. But the messages is not coming in anymore.



Please check/ debug what this other application instance is doing (what method is invoked when you break connection)
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Wed Jun 06, 2007 3:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Even though you have the same code, do you have the same JNDI?
Are both factories set up with fail if quiescing?
How long is the connection interrupted before the the exception occurs?
What operation was your code in or about to do:
receive?, onMessage? etc...
What is your environment (J2EE Server / stand alone JMS app) ?

There are a ton of variables there....
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
SilentWind
PostPosted: Wed Jun 06, 2007 5:18 pm    Post subject: Re: lost connections on JMSException Reply with quote

Acolyte

Joined: 11 Jan 2006
Posts: 58

marcin.kasinski wrote:

But you mentioned that OnJMSException is invoked on one instance and on other not.
Did I miss something ?

Please check/ debug what this other application instance is doing (what method is invoked when you break connection)



fjb_saper wrote:

Even though you have the same code, do you have the same JNDI?
Are both factories set up with fail if quiescing?
How long is the connection interrupted before the the exception occurs?
What operation was your code in or about to do:
receive?, onMessage? etc...
What is your environment (J2EE Server / stand alone JMS app) ?

There are a ton of variables there....


Let me clarify further. The exactly same application running on two different machines connected to the same Websphere MQ server, when both disconnected at the same time (i.e. removing the LAN cable), has two different behaviour. Machine A calls the onJMSException successfully, but the Machine B doesn't.

Since it is the same code, they have same JNDI, same connection settings, same factory settings. A calls the method after 1-2 seconds, but B never calls (waited for one day). My onJMSException just reconnects all existing subscribers. I did not think it was necessary to post code as the code is working, else how did the Machine A reconnect successfully?

My environment is Websphere MQ server 6.0.2 and applications deployed on an Eclipse client.

Hence I would like to know if there will be such a scenario, (i.e. sometimes the JMSException cannot detect the lost connection), and any suggestions on how do I go about resolving or working around such an issue?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 07, 2007 2:18 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Quote:
Since it is the same code, they have same JNDI

I would beg to differ. The JNDI setup for the qmanager might differ slightly on the other machine... Seen it happen often enough... It could as well be environmental:
i.e. you do have the same JNDI but the JNDI has been optimized for the other machine and the environment is full of gremlins...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rparti
PostPosted: Thu Jun 07, 2007 3:21 pm    Post subject: Reply with quote

Voyager

Joined: 05 Oct 2005
Posts: 86
Location: U.S.A.

Compare your config files.....the JNDI might be different in the two instances
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 Java / JMS » lost connections on JMSException
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.