Form too Large Exception

Viewed 36845

When I send a large file using a post request the system shows an exception:

java.lang.IllegalStateException: Form too large1105723>200000
at org.mortbay.jetty.Request.extractParameters(Request.java:1404)
at org.mortbay.jetty.Request.getParameter(Request.java:749)......

When I search help for this in Google they give some help e.g., webappcontext.setMaxFormContentSize(5000000);

I am using this code but the problem is not solved

Also I am using the code jettyServer.setAttribute("org.mortbay.jetty.Request.maxFormContentSize", 5000000);

But no result

Note:-I am using Jetty-6.1.0

18 Answers

Unfortunately, I'm not able to make any changes to jetty.xml, so instead I simply set some options to adjust the maxFormContentSize like so:

JVM_OPTS="$JVM_OPTS -Dorg.eclipse.jetty.server.Request.maxFormContentSize=5000000"

This exists in the shell script that we use to launch our instance of Solr.

I use Spring boot and set server.jetty.max-http-post-size: maxSize in application.properties to fix it.

server.jetty.max-http-post-size: 500000

ActiveMQ:

The problem here is with Jetty, on which ActiveMQ is based. You can find more details here, documentation

Solution is in apache-activemq-5.9.0/bin/win64/wrapper.conf file, add the following line a after b (refer below).

  • a: wrapper.java.additional.16=-Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000
  • b: wrapper.java.additional.15=-Djava.security.auth.login.config=%ACTIVEMQ_CONF%/login.config

If you are running on a 32 bit computer, then please add the same line in apache-activemq-5.9.0/bin/win32/wrapper.conf.

Happy Coding..

set in jetty/webapps -> configure .xml (e.g jetty-web.xml) file

"-1" for unlimited content

<Set name="maxFormContentSize" type="int">600000</Set>

OR

<Set name="maxFormContentSize" type="int">-1</Set>

Related