Author |
Message
|
SilentWind |
Posted: Tue Jun 05, 2007 10:07 pm Post subject: lost connections on JMSException |
|
|
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 |
|
 |
marcin.kasinski |
Posted: Tue Jun 05, 2007 11:00 pm Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
SilentWind |
Posted: Tue Jun 05, 2007 11:38 pm Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
marcin.kasinski |
Posted: Wed Jun 06, 2007 12:08 am Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
SilentWind |
Posted: Wed Jun 06, 2007 12:20 am Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
marcin.kasinski |
Posted: Wed Jun 06, 2007 12:31 am Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
fjb_saper |
Posted: Wed Jun 06, 2007 3:03 am Post subject: |
|
|
 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 |
|
 |
SilentWind |
Posted: Wed Jun 06, 2007 5:18 pm Post subject: Re: lost connections on JMSException |
|
|
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 |
|
 |
fjb_saper |
Posted: Thu Jun 07, 2007 2:18 pm Post subject: |
|
|
 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 |
|
 |
rparti |
Posted: Thu Jun 07, 2007 3:21 pm Post subject: |
|
|
 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 |
|
 |
|