What causes java.lang.IllegalStateException: Post too large in tomcat / mod_jk
Asked Answered
W

3

8

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

Windflower answered 23/9, 2008 at 19:45 Comment(0)
M
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.

Moline answered 23/9, 2008 at 19:50 Comment(0)
C
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"/>
Curator answered 21/5, 2012 at 16:37 Comment(0)
C
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.

Cockle answered 29/7, 2014 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.