<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Identifying session status before performing actions on it
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/newway">Noa Drach</a> in <i>JBoss Messaging</i> - <a href="http://community.jboss.org/message/557733#557733">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I'm trying to see if I can implement a solution to a problem that I have, but if you think I'm looking in the wrong direction - please let me know.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>this is a description of my system:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>on the server side I have :</p><ol><li>JBOSS 4.2.3.GA for java 6</li><li>with JBOSS Messaging 1.4.5.GA</li><li>and remoting 2.2.3.sp1</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>i have multiple clients that run as follows:</p><ol><li>a process run using Java Service Wrapper by Tanuki</li><li>java code that connect to the server using JNDI lookup</li><li>CPP code activated through JNI.</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>the clients receive message from the server and process them in the cpp code and we tracked a bug that we have to the fact that multiple clients are handling the same message.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>after some digging up it looks like the connection to client A is lost after it receives the message and starts handling it and so the JMS redelivers the message to client B.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>when client A tries to commit is response to the session we get an exception, but it's too late since the cpp part already committed it's work.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>so what I wanted to know is if there is a way to query a session and see that it's still valid, or if you have an explanation as to why the connection is lost and what I need to do to prevent this</strong>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here are some of the messages we get -</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Server side:</p><blockquote class="jive-quote"><p>2010-08-16 16:10:35,468 DEBUG [org.jboss.remoting.ConnectionNotifier] <a class="jive-link-external-small" href="mailto:org.jboss.remoting.ConnectionNotifier@d77a85">org.jboss.remoting.ConnectionNotifier@d77a85</a> Server connection lost to client (session id = 3m3b533o-il79jy-gcxc7el5-1-gcxc7fmx-4</p>
<p>2010-08-16 16:10:35,468 DEBUG [org.jboss.jms.server.remoting.JMSServerInvocationHandler] removing callback handler ServerInvokerCallbackHandler[3m3b533o-il79jy-gcxc7el5-1-gcxc7fmx-4+3m3b533o-il79jy-gcxc7el5-1-gcxc7ip5-b]</p>
<p>2010-08-16 16:10:35,468 DEBUG [org.jboss.remoting.InvokerRegistry] removed SocketClientInvoker[11455a2, bisocket://x.x.x.x:657877203] from registry</p>
<p>2010-08-16 16:10:35,468 DEBUG [org.jboss.remoting.transport.socket.MicroSocketClientInvoker] SocketClientInvoker[11455a2, bisocket://x.x.x.x:657877203] disconnecting ...</p>
<p>2010-08-16 16:10:35,468 DEBUG [org.jboss.remoting.Client] Client[10883757:3m3b533o-il79jy-gcxc7el5-1-gcxc7fmx-4+3m3b533o-il79jy-gcxc7el5-1-gcxc7ip5-b] is disconnected</p>
<p>2010-08-16 16:10:35,468 DEBUG [org.jboss.remoting.callback.ServerInvokerCallbackHandler] ServerInvokerCallbackHandler[3m3b533o-il79jy-gcxc7el5-1-gcxc7fmx-4+3m3b533o-il79jy-gcxc7el5-1-gcxc7ip5-b] shut down</p>
<p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p>
<p>2010-08-16 16:10:36,171 DEBUG [org.jboss.jms.server.connectionmanager.SimpleConnectionManager] unregistered connection ConnectionEndpoint[w-ekj7cxcg-1-90c6cxcg-vn8ywe-o335b3m3] with remoting session ID ...-gcxc7fmx-4</p>
<p>2010-08-16 16:10:36,171 DEBUG [org.jboss.remoting.ConnectionNotifier] <a class="jive-link-external-small" href="mailto:org.jboss.remoting.ConnectionNotifier@d77a85">org.jboss.remoting.ConnectionNotifier@d77a85</a> notified ConnectionManager[a16b7c] of connection lost to: 3m3b533o-il79jy-gcxc7el5-1-gcxc7fmx-4</p>
<p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p>
<p>2010-08-16 16:10:41,171 DEBUG [org.jboss.jms.client.remoting.ClientSocketWrapper] ServerSocketWrapper[Socket[addr=/x.x.x.x,port=60490,localport=4457].1cd25f]: os = <a class="jive-link-external-small" href="mailto:java.net.SocketOutputStream@37633c">java.net.SocketOutputStream@37633c</a></p>
<p>2010-08-16 16:10:41,171 DEBUG [org.jboss.jms.client.remoting.ClientSocketWrapper] ServerSocketWrapper[Socket[addr=/x.x.x.x,port=60490,localport=4457].1cd25f]: os = <a class="jive-link-external-small" href="mailto:java.net.SocketOutputStream@542356">java.net.SocketOutputStream@542356</a></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>client side:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p>INFO   | jvm 1    | 2010/08/16 16:10:58 | an error occurred in HandleMessage: org.jboss.jms.exception.MessagingTransactionRolledBackException: Failed to invoke</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 | org.jboss.jms.exception.MessagingTransactionRolledBackException: Failed to invoke</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.tx.ResourceManager.commitLocal(ResourceManager.java:225)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.container.SessionAspect.handleCommit(SessionAspect.java:582)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect26.invoke(SessionAspect26.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientSessionDelegate$commit_8461082169793485964.invokeNext(ClientSessionDelegate$commit_8461082169793485964.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientSessionDelegate.commit(ClientSessionDelegate.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.JBossSession.commit(JBossSession.java:164)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at com.jni.WorkerJni.handleMessage(WorkerJni.java:224)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at com.jni.WorkerJni.main(WorkerJni.java:164)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at java.lang.reflect.Method.invoke(Method.java:597)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at java.lang.Thread.run(Thread.java:619)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 | Caused by: org.jboss.jms.exception.MessagingJMSException: Failed to invoke</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.DelegateSupport.handleThrowable(DelegateSupport.java:271)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:205)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientConnectionDelegate.org$jboss$jms$client$delegate$ClientConnectionDelegate$sendTransaction$aop(ClientConnectionDelegate.java:225)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientConnectionDelegate$sendTransaction_N3268650789275322226.invokeNext(ClientConnectionDelegate$sendTransaction_N3268650789275322226.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:92)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientConnectionDelegate$sendTransaction_N3268650789275322226.invokeNext(ClientConnectionDelegate$sendTransaction_N3268650789275322226.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientConnectionDelegate$sendTransaction_N3268650789275322226.invokeNext(ClientConnectionDelegate$sendTransaction_N3268650789275322226.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.ClientConnectionDelegate.sendTransaction(ClientConnectionDelegate.java)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.tx.ResourceManager.commitLocal(ResourceManager.java:206)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 ... 16 more</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 | Caused by: java.lang.IllegalStateException: Cannot find object in dispatcher with id w-ekj7cxcg-1-90c6cxcg-vn8ywe-o335b3m3</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.wireformat.ConnectionSendTransactionRequest.serverInvoke(ConnectionSendTransactionRequest.java:79)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.server.remoting.JMSServerInvocationHandler.invoke(JMSServerInvocationHandler.java:157)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:862)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:611)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:423)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:176)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:182)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.Client.invoke(Client.java:1925)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.Client.invoke(Client.java:786)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.remoting.Client.invoke(Client.java:774)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)</p>
<p>INFO   | jvm 1    | 2010/08/16 16:10:58 |                 ... 27 more</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>thanks,</p><p>Noa</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/557733#557733">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>