Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 721

How to resolve 413 Request Entity Too Large error in Java Web App in Azure?

$
0
0

I have a Java - JSP and Servlets web application hosted in Azure. One of the function in web app allows user to upload a comma separated CSV files. However when the file size of more than 2.8MB, the function errors out stating 413 Request Entity Too Large error.

I tried adding the following code around the servlet

@WebServlet("/UploadFileServlet")@MultipartConfig(    maxFileSize = 1024 * 1024 * 10)

I even tried added the following in the web.xml file

<servlet><servlet-name>UploadFileServlet</servlet-name><servlet-class>com.servlet.UploadFileServlet</servlet-class><multipart-config><!-- 10MB max file size --><max-file-size>10485760</max-file-size><!-- 20MB max request size --><max-request-size>20971520</max-request-size><!-- Size threshold after which files will be written to disk --><file-size-threshold>0</file-size-threshold></multipart-config></servlet><servlet-mapping><servlet-name>UploadFileServlet</servlet-name><url-pattern>/UploadFileServlet</url-pattern></servlet-mapping>

But this didn't resolve the issue. I read through articles that say we need to increase the max-limit for file size, but how do I do that since the application is hosted in Azure.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 721

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>