For the testing purposes I have added new Image (LARGE.JPG) in to resource folder and if you try to execute following command in browser you will hit an error.
http://localhost:9090/uploadResource/large
2020-04-06 19:41:40.693 ERROR 21016 --- [nio-9090-exec-1] o.s.boot.web.support.ErrorPageFilter : Forwarding to error page from request [/uploadResource/large] due to exception [org.apache.http.NoHttpResponseException: localhost:8080 failed to respond]
javax.jcr.RepositoryException: org.apache.http.NoHttpResponseException: localhost:8080 failed to respond
at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.start(RepositoryServiceImpl.java:634) ~[jackrabbit-spi2dav-2.19.3.jar:2.19.3]
at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl$BatchImpl.access$600(RepositoryServiceImpl.java:569) ~[jackrabbit-spi2dav-2.19.3.jar:2.19.3]
Exception in the Spring-Boot application |
Also if you check in JBoss log you should be see following exception.
19:41:40,712 ERROR [org.apache.jackrabbit.server.util.HttpMultipartPost] (default task-15) Error while processing multipart.: org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. UT000020: Connection terminated as request was larger than 10485760
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:351)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
at org.apache.jackrabbit.server.util.HttpMultipartPost.extractMultipart(HttpMultipartPost.java:76)
at org.apache.jackrabbit.server.util.HttpMultipartPost.<init>(HttpMultipartPost.java:51)
at org.apache.jackrabbit.server.util.RequestData.<init>(RequestData.java:36)
at org.apache.jackrabbit.server.remoting.davex.JcrRemotingServlet.doPost(JcrRemotingServlet.java:416)
at org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.execute(AbstractWebdavServlet.java:372)
at org.apache.jackrabbit.webdav.server.AbstractWebdavServlet.service(AbstractWebdavServlet.java:308)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at
Exception in JBoss EAP |
The main reason for this exception is we are trying to upload a file which size is larger than the default allowed size in JBoss.
Lets see how we can configure to allow JBoss to configure it for 100MB file.
First You have to log in to JBoss EAP admin console(http://127.0.0.1:9990/console/App.html#home) using username and password.
Then navigate to Configuration page and then click on "SubSystems" in left panel then click on "Web/HTTP - Undertow". Then Click on view button on "HTTP". Please refer to below image.
Then you should able to view similar page to below figure. Then click on "HTTP SERVER" Tab and click on View button as show in below figure.
Then click on "HTTP Listener" in right side panel and then click on Edit button as show in below figure.
Then find the parameter name "Max post size" and set value as "104857600" (this is in byte value) which equal to 100 MB. Then Click save button and re-lode the server.
After that change if you try to upload large file by following URL it will get sucess.
http://localhost:9090/uploadResource/large
You could see following output on web browser.
{"code":"1","desc":"Resource Added Successfully","t":null}
also if you try to access that image using following URL you should be able to see uploaded image.
Code base for this can be found in following GITHUB location.
No comments:
Post a Comment