Today while deploying a war file (development site code) in Tomcat 8, I faced the following issue regarding upload limit size in Apache Tomcat server. So I decided to increase limit Tomcat upload file size limit to higher than the default. The default upload limit is set to 50 MB.
Increasing Upload Size Limit
You can increase the Tomcat server upload file size limit by the editing webapps/manager/WEB-INF/web.xml configuration file and searching for the below content.
sudo nano /path/to/tomcat/webapps/manager/WEB-INF/web.xml
Update the following section:
<multipart-config>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
Edit max-file-size and max-request-size and increase it as your requirement. These values are defined in bytes and the default value is set to 50 MB. You can set the following value for-
- 100 MB => 104857600
- 200 MB => 209715200
Save the file and restart the Tomcat server to apply changes.
Wrap Up
In conclusion, the process of deploying a development site code on Tomcat 8 can sometimes be hindered by the default upload limit size, as was experienced when an attempt to upload a file exceeded the pre-configured maximum of 50 MB, leading to a SizeLimitExceededException. This issue can be resolved by increasing the Tomcat server’s upload file size limit. By editing the webapps/manager/WEB-INF/web.xml configuration file, developers can adjust the max-file-size and max-request-size parameters to accommodate larger files, up to 100 MB or even 200 MB, as per the requirements.
This solution not only overcomes the limitation but also highlights the flexibility and configurability of Apache Tomcat, allowing for a smoother development and deployment process. Restarting the Tomcat server after these changes ensures the new settings are applied, thus facilitating the management of larger file uploads effectively.
8 Comments
Here iam not able 2 see any manager folder in webapps? I need to increase the limit size fro 50mb to 100mb.
Kindly help
how can i alter when i run in STS..spring boot application?
I get below log
org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (74373986) exceeds the configured maximum (10485760)
at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.(FileUploadBase.java:808) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:256) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:280) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.connector.Request.parseParts(Request.java:2846) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.connector.Request.getParts(Request.java:2754) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
Hi ,
your sample code as below
52428800
52428800
0<
you have one more “<" in the tag of file-size-threshold
thanks for your sharing.
Thanks Yo
Thnx, this solve the problem.
how to set the uploads size in tomcat server
I was having issues with our server uploading .war file and this helped. THANK YOU
little error : 0<
see: <<