Jetty提交数据时报java.lang.IllegalStateException: Form too large270468>200000问题解决
今天在使用Eclipse的Jetty插件做为服务器提交富文本编辑中的数据时,报如下异常:
在\eclipse\plugins目录下,找到org.mortbay.jetty.server_6.1.23.v201012071420.jar包,扔进JD-GUI中,根据报错提示信息org.morbay.jetty.Request.extractParameters()方法中找到如下信息:

注意观察箭头所示部分,异常应该是这儿抛出来的,但maxFormContentSize值是从那里来的呢,依据this._context.getContextHandler().getMaxFormContentSize()这句提示,找到org.mortbay.jetty.handlerContextHandler.class类,结果发现该类中有如下一句,兴奋,默认值在此。

那么这个默认值是设置好的,如何修改呢,通过看Request类里的this._context.getContextHandler().getMaxFormContentSize()代码,继续追踪,该值应该是从WEB的入口获取的即web.xml,但是这个值如何传进去呢,经过网上的搜索与实践,可以在WEB-INF目录下新建一个jetty-web.xml文件,里面写如下内容,对maxFormContentSize重新赋值即可(Jetty6适用):
那么其它服务器有没有类似情况,答案当然是肯定的,如Tomcat,通过搜索找到了如下内容:
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) to
increase the limit. Setting it to 0 will disable the size check.
意思是说,tomcat默认设置能接收HTTP POST请求的大小最大为2M,如果你的POST请求传递的数据大于2M,就会报这个错误.解决的办法是修改tomcat的配置文件$TOMCAT_HOME$/conf/server.xml,找到里面的<Connector>标签,在该标签中添加"maxPostSize"属性,将该属性值设置成你想要的最大值,单位是字节,如果你把这个值设置为0(maxPostSize="0"),tomcat将不再检查POST的大小.
本人测试环境如下:
Jetty版本:Run Jetty Run Feature1.2.2.1
Jetty对应的jar包版本:org.mortbay.jetty.server_6.1.23.v201012071420.jar
对于Jetty7只需改下包的路径,完整配置文件如下:
Jetty提交数据时报java.lang.IllegalStateException: Form too large270468>200000问题解决的更多相关文章
- Jetty错误:java.lang.IllegalStateException: Form too large 270468>200000的问题解决
说明: 1.200000单位为byte,并不是2MB,而是200KB,换算参考:https://calc.itzmx.com/ 2.这个是表单提交后长度超过了200KB造成的,除了表单Form,还有U ...
- struts2 下载时报java.lang.IllegalStateException
-----------------------------------------struts2 下载时报java.lang.IllegalStateException---------------- ...
- 处理eclipse启动时报java.lang.IllegalStateException
这是我写的第一篇博客,博客我来了: 我是好学的人,希望在这上面遇到志同道合的人,对技术有更高追求的人: 重启eclipse的时候报出来 An error has occurred, See the l ...
- Jetty错误: badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@472adad9{r=2,c=false,a=IDLE,uri=}
最近用Jetty跑Spring MVC接收POST请求(POST中数据很大).出现数据无法获取到的问题.如: @RequestMapping(value = "/receive", ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
(1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...
- Caused by: java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$Match
spring 4.0.2,mybatis 3.2.6,aspectjweaver 1.8.10 使用的时候,报错: Caused by: java.lang.IllegalStateException ...
- 使用RestTemplate时报错java.lang.IllegalStateException: No instances available for 127.0.0.1
我在RestTemplate的配置类里使用了 @LoadBalanced@Componentpublic class RestTemplateConfig { @Bean @LoadBalanced ...
- Eclipse------使用Debug As时报错java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:/XXX
报错信息: java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file ...
- ES failed to notify ClusterStateListener java.lang.IllegalStateException: environment is not locked
ES出现异常: failed to notify ClusterStateListenerjava.lang.IllegalStateException: environment is not loc ...
随机推荐
- 005. asp.net页面常用指令
页面指令 用于通知编译器在编译该页面时做出什么样的处理方式, 欢聚换来讲, 页面指令指定了执行该页面的运行时环境, 当编译器处理应用程序时, 可以通过这些指令来让编译器做特定的处理; 在asp.ne ...
- 九度OJ 1010:计算A+B【字符串和数组】
/*======================================================================== 题目1010:A + B 时间限制:1 秒内存限制 ...
- wikioi 1202 求和(求n个数的和)
/*============================================================= 1202 求和 题目描述 Description 求n个数的和 输入描述 ...
- 【转】keypress keydown keyup 区别
KeyPress主要用来接收字母.数字等ANSI字符,而 KeyDown 和 KeyUP 事件过程可以处理任何不被 KeyPress 识别的击键,诸如:功能键(F1-F12).编辑键.定位键以及任何这 ...
- 转:Scrapy安装、爬虫入门教程、爬虫实例(豆瓣电影爬虫)
Scrapy在window上的安装教程见下面的链接:Scrapy安装教程 上述安装教程已实践,可行.(本来打算在ubuntu上安装Scrapy的,但是Ubuntu 磁盘空间太少了,还没扩展磁盘空间,所 ...
- [mysql] linux 下mysql 5.7.12 安装
1.下载mysql wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar ...
- JS如何调用隐藏按钮的click事件
js如何调用隐藏按钮的click事件:1.设定隐藏不要使用Visiable属性,使用style.display=none:2.触发JS事件可以使用fireEvent方法,如:document.getE ...
- 【linux】who&&w
who和w 看到目前服务器所登陆的用户,区别是w能看到更详细的信息. [root@andon tmp]# who admin tty5[tty指本地登陆] 2016-05-27 15:16[登陆时间] ...
- 用jquery在必填表单字段前加红星总结
一.总结: 今天公司项目中要求给表单中的必填字段添加标记,因为表单字段比较多,后期又有可能某些字段会有变化,所以写了一段js代码来给表单添加标记. html代码: js代码: 关键步骤: 1.红星的设 ...
- 【Spring学习笔记-MVC-3.1】SpringMVC返回Json数据-方式1-扩展
<Spring学习笔记-MVC>系列文章,讲解返回json数据的文章共有3篇,分别为: [Spring学习笔记-MVC-3]SpringMVC返回Json数据-方式1:http://www ...