How big a war file should be?
Asked Answered
L

5

20

Tomcat 7 manager limit the war file size to 50 Mo.

  • Why this limitation of 50 Mo ?
  • What should be the maximum war file size ? (in practice)

I'm working with Grails 2.2 which generate a minimal WAR of 28 Mo. So, the limit of 50 Min is very easy to reach.

Liquescent answered 9/4, 2013 at 15:24 Comment(0)
H
27

This is only a limit set for you to upload and deploy via the Tomcat 7 manager. There really is not a limit on the size of the war file you can deploy to a tomcat server.

Here is a link that can help you increase this upload size.

Quoted from link --

Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml. Increase the max-file-size and max-request-size:

<!– 50MB max –>

 <max-file-size>52428800</max-file-size>

 <max-request-size>52428800</max-request-size>

 <file-size-threshold>0</file-size-threshold>

 </multipart-config>
Hudnall answered 9/4, 2013 at 15:28 Comment(0)
E
9

If you're using Tomcat 8, the max-file-size is not in web.xml anymore. Instead, open conf/server.xml and find the tag entry for the HTTP connector. Then add the

maxPostSize="0"

attribute and value to this tag. When you have completed editing the conf/server.xml file, save it and restart Apache Tomcat.

Epiphenomenon answered 21/12, 2013 at 5:15 Comment(1)
max-file-size is still in web.xml as of Tomcat 8.0.20, set to 50MB as in Oscar Lopez's answer.Pozsony
C
7

The 50 MB default file size limit is not hard-coded, you can change it in the web.xml file of the Manager application of your webapp folder. You'll have to increase the max-file-size and max-request-size:

<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>

Replace the current values with the appropriate values for your needs.

Caernarvonshire answered 9/4, 2013 at 15:29 Comment(0)
L
0

Go to the web.xml of the manager application (for instance it could be under /tomcat7/webapps/manager/WEB-INF/web.xml.

Increase the max-file-size and max-request-size to for example 100Mb

Latchstring answered 9/4, 2013 at 15:30 Comment(0)
P
-1

In tomcat7, update the tomcat7/server.xml. I installed tomcat7 in ubuntu so the directory is like below

ll /etc/tomcat7/
total 220
drwxr-xr-x   4 root root      4096 Oct  6 18:14 ./
drwxr-xr-x 136 root root     12288 Oct  6 16:12 ../
drwxrwxr-x   3 root tomcat7   4096 Sep 23 15:44 Catalina/
-rw-r--r--   1 root tomcat7   6506 Jun 27 12:48 catalina.properties
-rw-r--r--   1 root tomcat7   1394 Jan 25  2014 context.xml
-rw-r--r--   1 root tomcat7   2370 Feb 18  2016 logging.properties
drwxr-xr-x   2 root tomcat7   4096 Sep 23 16:06 policy.d/
-rw-r--r--   1 root tomcat7   6716 Oct  6 18:14 server.xml
-rw-r-----   1 root tomcat7   1607 Sep 23 15:50 tomcat-users.xml
-rw-r--r--   1 root tomcat7 168099 Nov 25  2015 web.xml

You would see the connector section in the conf file etc/tomcat7/server.xml,

<!-- A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443"/>

Stop the tomcat and just add the maxPostSize at the end,

sudo service tomcat7 stop

Update the connector in the server.xml,

<!-- A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" 
           maxPostSize="57000000"/>

Then restart the tomcat.

sudo service tomcat7 start
Percentile answered 7/10, 2016 at 1:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.