今天在使用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问题解决的更多相关文章

  1. Jetty错误:java.lang.IllegalStateException: Form too large 270468>200000的问题解决

    说明: 1.200000单位为byte,并不是2MB,而是200KB,换算参考:https://calc.itzmx.com/ 2.这个是表单提交后长度超过了200KB造成的,除了表单Form,还有U ...

  2. struts2 下载时报java.lang.IllegalStateException

    -----------------------------------------struts2 下载时报java.lang.IllegalStateException---------------- ...

  3. 处理eclipse启动时报java.lang.IllegalStateException

    这是我写的第一篇博客,博客我来了: 我是好学的人,希望在这上面遇到志同道合的人,对技术有更高追求的人: 重启eclipse的时候报出来 An error has occurred, See the l ...

  4. 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", ...

  5. java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决

    (1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...

  6. 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 ...

  7. 使用RestTemplate时报错java.lang.IllegalStateException: No instances available for 127.0.0.1

    我在RestTemplate的配置类里使用了 @LoadBalanced@Componentpublic class RestTemplateConfig { @Bean @LoadBalanced ...

  8. 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 ...

  9. ES failed to notify ClusterStateListener java.lang.IllegalStateException: environment is not locked

    ES出现异常: failed to notify ClusterStateListenerjava.lang.IllegalStateException: environment is not loc ...

随机推荐

  1. linux服务之openldap

    http://www.openldap.org/ http://blog.csdn.net/chinalinuxzend/article/details/1870656 OpenLDAP学习笔记 ht ...

  2. 【转】关于IE7 z-index问题完美解决方案

    来源:http://jacobcookie.iteye.com/blog/1876426 浏览器兼容性问题太让人蛋疼了,今天可是废在了IE7的z-index问题上.可又不能因为浏览器版本低而不去解决, ...

  3. SVN的分支、主干合并的使用说明

    EBAPP代码SVN服务器地址:http://scm.jrj.cn/webapp/ 使用右键菜单中SVN的二级菜单Repo-Broswer查看SVN服务器目录结构 目录结构如下: 名称及功能说明: T ...

  4. SSDB

    一个高性能的支持丰富数据结构的 NoSQL 数据库, 用于替代 Redis. 特性 替代 Redis 数据库, Redis 的 100 倍容量 LevelDB 网络支持, 使用 C/C++ 开发 Re ...

  5. GitHub简单使用入门

    自从google code关闭了下载服务了之后,GitHub作为了目前最好用的免费开源项目托管站点,众多开源项目都托管在github,其中不乏著名的播放器MPC-HC. 不习惯于英文的朋友,难免少不了 ...

  6. HTML5 CANVAS 高级

    加载图片 获取图像有三种方式: a : createImageData(),没有效率,一个像素一个像素的绘制: b : var img= document.getElementById("i ...

  7. row_number()over(order by id) SQL顺序排列

    select *,row_number()over(order by id) as number_id from [dbo].tb_pccw20140213

  8. 【Struts2学习笔记-6--】Struts2之拦截器

    简单拦截器的使用 拦截器最基本的使用: 拦截方法的拦截器 拦截器的执行顺序 拦截结果的监听器-相当于 后拦截器 执行顺序: 覆盖拦截器栈里特定拦截器的参数 使用拦截器完成-权限控制 主要完成两个功能: ...

  9. IntelliJ IDEA中怎么查看文件中所有方法?

    可以使用快捷键ALT + 7打开左侧的Structure查看当前文件中的所有方法.   来自为知笔记(Wiz)

  10. 一个android的各种控件库

    在这里 https://github.com/Trinea/android-open-project 很多的listview,非常棒