Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Catching java.io.IOException on the server side

Hello list,

I hope somebody can point me in the right direction with the following. I already asked the Apache CXF user list (http://cxf.547215.n5.nabble.com/Catching-java-io-IOException-on-the-server-side-td5745530.html) but the few recommendations did not work. 

>>> copied from the post >>>

Think of a simple restful webservice which just echos the data - for sure the real WS is much more complex running on ServiceMix (4.5.3 with CXF 2.6.9). The answer is delayed by 15 seconds to simulate processing time. The test client calling the WS has a requestTimeout of 10 seconds. As expected the client drops the connection and throws an exception. On the server side the process waits until the 15 seconds are over and tries to send the data back to the client - which is not longer listening. As expected the server throws an IOException (connection reset by peer). 

The problem is that I want to catch this exception and forward the not delivered answer to a JMS queue.
<<< copied from the post <<<

I failed to get this managed with Apache CXF and I failed with Apache Camel.

Based on the stack trace I think CXF and Camel are already done and the IOException has to handled by Jetty.


16:17:23,333 | DEBUG | /rs/Echo/process | Server                           | 268 - org.eclipse.jetty.util - 7.5.4.v20111024 | RESPONSE /cxf/rs/Echo/process  200
16:17:23,333 | DEBUG | qtp1008596480-32 | ChannelEndPoint                  | 268 - org.eclipse.jetty.util - 7.5.4.v20111024 | 
java.io.IOException: Connection reset by peer
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)[:1.7.0_55]
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)[:1.7.0_55]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)[:1.7.0_55]
	at sun.nio.ch.IOUtil.read(IOUtil.java:197)[:1.7.0_55]
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)[:1.7.0_55]
	at org.eclipse.jetty.io.nio.ChannelEndPoint.fill(ChannelEndPoint.java:186)[260:org.eclipse.jetty.io:7.5.4.v20111024]
	at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.fill(BlockingChannelConnector.java:237)[264:org.eclipse.jetty.server:7.5.4.v20111024]
	at org.eclipse.jetty.http.HttpParser.fill(HttpParser.java:949)[265:org.eclipse.jetty.http:7.5.4.v20111024]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:274)[265:org.eclipse.jetty.http:7.5.4.v20111024]
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)[265:org.eclipse.jetty.http:7.5.4.v20111024]
	at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:50)[264:org.eclipse.jetty.server:7.5.4.v20111024]
	at org.eclipse.jetty.server.nio.BlockingChannelConnector$BlockingChannelEndPoint.run(BlockingChannelConnector.java:293)[264:org.eclipse.jetty.server:7.5.4.v20111024]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)[268:org.eclipse.jetty.util:7.5.4.v20111024]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)[268:org.eclipse.jetty.util:7.5.4.v20111024]
	at java.lang.Thread.run(Thread.java:745)[:1.7.0_55]
16:17:23,334 | DEBUG | qtp1008596480-32 | HttpConnection                   | 268 - org.eclipse.jetty.util - 7.5.4.v20111024 | closed org.eclipse.jetty.server.BlockingHttpConnection@799e037@127.0.0.1:10080<->127.0.0.1:49261

So ..

(1) How can I catch the IOException in Jetty?

(2) Since I’m running ServiceMix 4.5.3 what is the procedure to get it done in this runtime?

Thanks for any help,
harald

Back to the top