I have Tomcat streaming data to a Java client via http. It copies bytes from the file to the HTTPServletResponse output stream to the servlet.
The client uses HttpURLConnection to connect and read data.
Sometimes everything is fine, sometimes both the client and the server throw an exception.
The client says there is a "Premature EOF".
The server requires a "ClientAbortException".
Not only one of the above?
CLIENT:
java.io.IOException: Premature EOF at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:234) at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:662) at java.io.FilterInputStream.read(FilterInputStream.java:116) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2669) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2664)java.io.IOException: Premature EOF at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:234) at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:662) at java.io.FilterInputStream.read(FilterInputStream.java:116) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2669) at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2664)
SERVER:
ClientAbortException: java.io.IOException at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:358) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89) ... Caused by: java.io.IOException at org.apache.coyote.ajp.AjpAprProcessor.flush(AjpAprProcessor.java:1223) at org.apache.coyote.ajp.AjpAprProcessor$SocketOutputBuffer.doWrite(AjpAprProcessor.java:1310) at org.apache.coyote.Response.doWrite(Response.java:560) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353) ... 23 more
z5h
source share