I'm not sure if this can be done at the jaxrpc level but one way maybe to
install a filter that wraps the response stream and get the filter to detect
the error case,
Kevin Jones
http://public.xdi.org/=kevin.jones
skype (www.skype.com): kevinrjones
_____
From: Ian Jones [mailto:ijones_at_piper-group.com]
Sent: 18 November 2004 10:40
To: users_at_jax-rpc.dev.java.net
Subject: server side detection of connection loss
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:8
5)
at
com.sun.xml.rpc.server.http.JAXRPCServletDelegate.writeReply(JAXRPCServletDe
legate.java:427)
at
com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelega
te.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(Application
FilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.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(StandardValveContex
t.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.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(StandardValveContex
t.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.processConne
ction(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a: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.