users@jax-rpc.java.net

Re: server side detection of connection loss

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Thu, 18 Nov 2004 09:14:49 -0800

Try writing a handler.

Ian Jones wrote:

> Hello,
>
> I’m using JAX RPC to send data and files between a client and server
> application using Tomcat for the web service. I am now trying to
> handle error situations such as when communication between the server
> and client is lost. For the client application this has proved to be
> fairly simple as there is always at least on request waiting for a
> response from the server so a RemoteException gets caught when the
> communication falls over. However on the server side, I am having
> problems. Unlike the client, the server doesn’t know until a response
> is sent back to the client that something has gone wrong. And, even
> then, the only exception I see is this:
>
> 18-Nov-2004 10:32:56 com.sun.xml.rpc.server.http.JAXRPCServletDelegate
> doPost
>
> SEVERE: caught throwable
>
> ClientAbortException: java.net.SocketException: Connection reset by
> peer: socket write error
>
> at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:331)
>
> at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:297)
>
> at
> org.apache.coyote.tomcat5.CoyoteOutputStream.flush(CoyoteOutputStream.java:85)
>
> at
> com.sun.xml.rpc.server.http.JAXRPCServletDelegate.writeReply(JAXRPCServletDelegate.java:427)
>
> at
> com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:352)
>
> at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
>
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
>
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
>
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
>
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
>
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>
> at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
>
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
>
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
>
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
>
> at java.lang.Thread.run(Thread.java:534)
>
> I do not seem to be able to catch this exception being thrown so I can
> not do the necessary processing and tidying up that I need to do in
> this event. Does anyone know if there is a way of catching this? Or is
> there a better way of detecting this communication loss situation on
> the server? I had thought that establishing a connection back to the
> client from the server would work for this, i.e. creating some server
> process on the client for the web service to connect back to, but I
> haven’t needed to do this for any other part of the processing so far
> so it would seem neater to avoid it if possible.
>
> Any thoughts greatly appreciated,
>
> Ian Jones
>
> Senior Analyst Developer
>
> Piper Group plc
>
> Email: ijones_at_piper-group.com
>
> Tel: + 44 (0) 1454 284900
>
> Fax: + 44 (0) 1454 284950
>
> www.piper-group.com <http://www.piper-group.com/>
>
> Information contained in this e-mail is intended for the use of the
> addressee only, and is confidential and may be the subject of legal
> professional privilege. Any dissemination, distribution, copying or
> use of this communication without permission of the addressee is
> strictly prohibited. The views expressed in this communication may not
> necessarily be the views held by Piper Group plc.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net