Setting Apache HTTP server upload limit

Today encounter an issue to upload image and then saw the below exception stack:

Caused by: org.apache.commons.fileupload.FileUploadException
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:385) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) [commons-fileupload-1.2.2.jar:1.2.2]
at org.springframework.web.multipart.commons.CommonsMultipartResolver.parseRequest(CommonsMultipartResolver.java:156) [spring-web-3.2.12.RELEASE.jar:3.2.12.RELEASE]
... 88 more
Caused by: ClientAbortException:  java.io.IOException: Socket read failed
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:357) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:420) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:379) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:193) [jbossweb-7.0.13.Final.jar:]
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:976) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:886) [commons-fileupload-1.2.2.jar:1.2.2]
at java.io.InputStream.read(InputStream.java:82) [rt.jar:1.6.0_38]
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:592) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:618) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:637) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:984) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:965) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) [commons-fileupload-1.2.2.jar:1.2.2]
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351) [commons-fileupload-1.2.2.jar:1.2.2]
... 90 more
Caused by: java.io.IOException: Socket read failed
at org.apache.coyote.ajp.AjpProcessor.read(AjpProcessor.java:1135) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.ajp.AjpProcessor.readMessage(AjpProcessor.java:1213) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.ajp.AjpProcessor.receive(AjpProcessor.java:1152) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.ajp.AjpProcessor.refillReadBuffer(AjpProcessor.java:1193) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.ajp.AjpProcessor.access$000(AjpProcessor.java:65) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.ajp.AjpProcessor$SocketInputBuffer.doRead(AjpProcessor.java:1282) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.Request.doRead(Request.java:438) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:347) [jbossweb-7.0.13.Final.jar:]
... 105 more


To set the limit of the upload file size in Apache HTTP server, add the following parameter in the httpd.conf file

LimitRequestBody 10000000

This will allow file size up to 10MB to be uploaded through the Apache HTTP Server.

Thats all for today. Have a great configuration time!

Comments

Popular posts from this blog

Django Form: MultipleChoiceField and How To Have Choices From Model Example

DJango Queryset comparing date time

Jquery Validation fix for date format dd/mm/yyyy in Chrome and Safari