Java. Lang. illegalstateexception: Post too large exception and Its Solution

Source: Internet
Author: User
Tags apache tomcat

When Tomcat is used, java. Lang. illegalstateexception: Post too large exception occurs when submit is used to pass values to the background,

 

Address found on the Internet: http://hi.baidu.com/llscompazz/blog/item/88a4f0c33fb6d551b219a87b.html

Bytes ---------------------------------------------------------------------------------------------

Java. Lang. illegalstateexception: Post too large exception and Solution

Today, a large amount of data is submitted, and an error is returned, saying post too large...

Another prompt is parameters were not parsed because the size of the posted data was too big. Use the maxpostsize attribute of the connector to resolve this if the application shocould accept large posts.

I don't know if this error is rarely encountered by people in China. A few people wrote it out. I found the cause and solution on a foreign website:

Q: In tomcat, I got a "post data too big" error.

A: 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 2097152 (2 MB). When you try to upload files or post forms that are
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's server. xml.
In the <connector> element, add an attribute "maxpostsize" and set a larger value (in bytes)
Increase the limit. Setting it to 0 will disable the size check.

It means that by default, Tomcat sets a maximum size of 2 MB for receiving http post requests. If the data transmitted by your POST request is greater than 2 MB, this error will be reported. the solution is to modify the tomcat configuration file $ tomcat_home $/CONF/server. XML, find the <connector> tag in the tag, add the "maxpostsize" attribute to the tag, and set the attribute value to the maximum value, in bytes, if you set this value to 0 (maxpostsize = "0"), Tomcat will no longer check the post size.

Bytes ----------------------------------------------------------------------------------------------

 

 

I modified my tomcat configuration file;

<Connector
Port = "8080" maxthreads = "150" minsparethreads = "25" maxsparethreads = "75"
Enablelookups = "false" redirectport = "8443" acceptcount = "100"
DEBUG = "0" connectiontimeout = "20000"
Disableuploadtimeout = "true" uriencoding = "gb2312" maxpostsize = "0"/>

 

Now we can post the data that is normally transferred more than 2 MB.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.