File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes ClientAbortException:  java.net.SocketException:Software caused connection abort: socket write error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "ClientAbortException:  java.net.SocketException:Software caused connection abort: socket write error" Watch "ClientAbortException:  java.net.SocketException:Software caused connection abort: socket write error" New topic
Author

ClientAbortException: java.net.SocketException:Software caused connection abort: socket write error

Muhammad Arif
Greenhorn

Joined: Jan 07, 2009
Posts: 5
I have problem while sending the data on mobile client. This is happing when I sending file(audio, image or video) of size 2 or more MB.
The exact exception is here


INFO 07 Jan 2009 13:20:03,562 (DownlaoderServlet.java:77) - fie size 1737743
INFO 07 Jan 2009 13:20:03,593 (DownlaoderServlet.java:87) - error in writing file on stream
ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:76)
at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:156)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:114)
at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
at com.tcm.autumn.servlets.DownlaoderServlet.doGet(DownlaoderServlet.java:81)
at com.tcm.autumn.servlets.DownlaoderServlet.doPost(DownlaoderServlet.java:110)
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:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)




if file size is less then the 2MB then file send successfully. Sir can you help me in this type of error. File reading and sending code is here.


try{
…………………………
byte[] fileInArray = null;
fileInArray = readFileByte(fileUrl);
OutputStream outStream = new GZIPOutputStream(response.getOutputStream());
output.write(fileInArray); // got exception here
……………………………
outStream.flush();
outStream.close();
}catch(Exception e){

}



public static byte[] readFileByte(String filePath) throws FileNotFoundException, IOException
{
FileInputStream fileInputStream = null;
byte[] contentByte = null;
File contentFile = new File(filePath);
int contentSize = (int) contentFile.length();
fileInputStream = new FileInputStream(contentFile);

contentByte = new byte[contentSize];
fileInputStream.read(contentByte);

fileInputStream.close();
return contentByte;
}
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8996
    
    9

Please do not post the same question more than once. It wastes people's time when multiple conversations take place.
CarefullyChooseOneForum

[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClientAbortException: java.net.SocketException:Software caused connection abort: socket write error