why does Java servlet gives ClientAbortException when file size larger than about 2 MB? -


I am trying to write a Java sublett on the Linux server, which can be used by client to download is a video file it works file size small (probably MB less than 2), but larger file size error: org.apache.catalina.connector.ClientAbortException: java.io.IOException: broken pipe .

After performing a Google search, it seems that this error occurs when the client breaks the connection. In my case, I am using a customer and can confirm that I am not doing anything which will break the connection (not least on purpose) - the browser remains open, etc. When this error occurs then is.

Any idea what is the reason (and how to fix it)?

  Public class GetFile HttpServlet spreads {@Override Public Zero Init (ServletConfig config) throws ServiceExtension {super.init (config); } Protected void doPost (HttpServletRequest request, HttpServletResponse res) throws ServletException, IOException {String filename = "init_java"; Try {// user parameter file name = req.getParameter ("fileId"); // full path // video file for //res.setContentType ("Video / MP3"); // res.setContentType is not working ("App / X-download"); File file = new file (file name); If (file.exists ()) {res.setHeader ("content-displacement", "inline; filename = \" "+ file name +" \ ""); Res.setHeader ("cache-control", "cache, must-modify"); //res.setHeader("Pragma "," public "); // Not sure when using the return file (file name, res.getOutputStream ()); } Else {// error handling goes here}} catch (Exception e) {...} finally {...}} private static void ReturnFile (string filename, out OutputStream) FileNotFoundException, IOException {InputStream throws = null In; Try {New = BufferedInputStream (New FileInputStream (filename)); Byte [] buf = new byte [4 * 1024]; // 4K buffer by bit read; While ((bytes read = in. Raid (buff))! = -1) {out.written (buff, 0, bytes read); }} Finally {if (in! = Null) in.close (); }}}  

UPDATE 1

I see the following code in mod_jk file (which can transmit requests from Apache web server GlassFish application server):

  [information] init_jk :: mod_jk . C (3383): mod_jk / 1.2.40 Start [error] ajp_connection_tcp_get_message :: jk_ajp_common.c (1313): the wrong message format 0xcad5 :: 1: 8009 [error] ajp_get_reply :: jk_ajp_common.c (2204): (worker1) Tommak is down or the problem of network A part of the response has already been sent to the customer [info] ajp_service :: jk_ajp_common.c (2673): due to protocol error (attempt = 1) (worker 1) biscuits request failed ( Recoverable) [info] ajp_process_callback:: Jk_ajp_common.c (2000): Client Cancel or Client Network Problems [ Information] ajp_service :: jk_ajp_common.c (2673): (1 worker) failed to request biscuits due to error writing the client (try = 2 (unattainable)) [Info] jk_handler :: mod_jk.c (2799) : Worker = Canceling connection for employee 1  

It looks like what I'm looking for, but I'm not an expert here - does it offer any insights Could be the root cause?

This is probably due to a limit set that you check the property file on the server I'm sure there There is no one who does not say bigger than 2 MB.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -