8

what configuration needs to be tweaked, and where does it live, in order to increase the maximum allowed post size?

masukomi
  • 8,507
  • 8
  • 35
  • 45

3 Answers3

22

Apache Tomcat by default sets a limit on the maximum size of HTTP POST requests it accepts. In Tomcat 5, this limit is set to 2 MB. When you try to upload files larger than 2 MB, this error can occur.

The solution is to reconfigure Tomcat to accept larger POST requests, either by increasing the limit, or by disabling it. This can be done by editing [TOMCAT_DIR]/conf/server.xml. Set the Tomcat configuration parameter maxPostSize for the HTTPConnector to a larger value (in bytes) to increase the limit. Setting it to 0 in will disable the size check. See the Tomcat Configuration Reference for more information.

Steve K
  • 18,892
  • 6
  • 48
  • 49
4

It will be for others persons, I see you are coupling Apache HTTP and Tomcat (tomcat / mod_jk), in this case edit the Coyote/JK2 AJP 1.3 Connector the same way you do it for the standard connector (Coyote HTTP/1.1), because the AJP1.3 Connector is where Tomcat receive data.

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector port="8009" 
           enableLookups="false" redirectPort="8443" debug="0"
           protocol="AJP/1.3" maxPostSize="0"/>
RAS
  • 7,807
  • 15
  • 61
  • 81
Ahmed MANSOUR
  • 1,861
  • 1
  • 22
  • 32
0

The root cause of IllegalStateException exception is a java servlet is attempting to write to the output stream after the response has been committed.

Take care that no content is added to the response after redirecting/dispatching request.

Prashant Kumar
  • 14,945
  • 14
  • 46
  • 63