说明:

1、200000单位为byte,并不是2MB,而是200KB,换算参考:https://calc.itzmx.com/

2、这个是表单提交后长度超过了200KB造成的,除了表单Form,还有URI等长度;这类解决问题都可以针对Jetty进行下手,配置相应的参数来记性解决。

3、如果请求经过了Nginx或者Apache这些,那么解决时要注意排查这些的影响。

错误:

java.lang.IllegalStateException: Form too large270468>200000
at org.mortbay.jetty.Request.extractParameters(Request.java:1561)
at org.mortbay.jetty.Request.getParameterMap(Request.java:870)
at org.apache.struts2.dispatcher.Dispatcher.createContextMap(Dispatcher.java:528)
at org.apache.struts2.dispatcher.ng.PrepareOperations.createActionContext(PrepareOperations.java:78)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

解决方法:

1、普通Web项目:

先从这个参数入手maxFormContentSize

Jetty7:org.eclipse.jetty.server.Request.maxFormContentSize=-1
Jetty6:org.mortbay.jetty.Request.maxFormContentSize=-1

-1表示不限制,2000000表示2MB的限制范围。

①在Jetty目录下找到jetty.xml中配置:

Jetty7:
<Call class="java.lang.System" name="setProperty">
<Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg>
<Arg>-1</Arg>
</Call>
Jetty6:
<Call class="java.lang.System" name="setProperty">
<Arg>org.mortbay.jetty.Request.maxFormContentSize</Arg>
<Arg>-1</Arg>
</Call>

②在Web项目中的WEB-INF文件夹下新建一个jetty-web.xml文件

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="WebAppContext" class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="maxFormContentSize" type="int">6000000</Set>
</Configure>

2、针对Maven的Jetty插件运行的配置

Maven Jetty Plugin 6.x
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<jetty.version>6.1.25</jetty.version>
<configuration>
<!-- 增加systemProperties属性 -->
<systemProperties>
<systemProperty>
<name>org.mortbay.jetty.Request.maxFormContentSize</name>
<!-- -1代表不作限制 -->
<value>-1</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
或者可以使用运行时给出参数的方式进行设置
jetty:run -Dorg.mortbay.jetty.Request.maxFormContentSize=-1 Maven Jetty Plugin 7.x情况下
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<jetty.version>6.1.25</jetty.version>
<configuration>
<!-- 增加systemProperties属性 -->
<systemProperties>
<systemProperty>
<!-- 替换成org.eclipse.jetty.server.Request.maxFormContentSize -->
<name>org.eclipse.jetty.server.Request.maxFormContentSize</name>
<!-- -1代表不作限制 -->
<value>-1</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
运行时参数方式
jetty:run -Dorg.eclipse.jetty.server.Request.maxFormContentSize=-1

3、针对Spring Boot项目的配置

经过研究,无法指定这些参数,只需配置以下方式即可:

#POST表单长度限制(5MB)
server.max-http-post-size=5000000

对于Spring Boot还有很多这类相关的参数,可以通过具体需要来配置。

参考:

http://blog.csdn.net/madding/article/details/6759603

https://www.cnblogs.com/king1302217/p/4201071.html

http://blog.sina.com.cn/s/blog_dbc9a8040102vkcp.html

http://ray-yui.iteye.com/blog/1929184

https://stackoverflow.com/questions/36872540/spring-boot-rest-service-form-too-large

https://stackoverflow.com/questions/33232849/increase-http-post-maxpostsize-in-spring-boot

Jetty错误:java.lang.IllegalStateException: Form too large 270468>200000的问题解决的更多相关文章

  1. 集成JUnit测试错误java.lang.IllegalStateException: Failed to load ApplicationContext

    1 详细错误信息 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.t ...

  2. Spring Boot整合Mybatis出现错误java.lang.IllegalStateException: Cannot load driver class:com.mysql.cj.jdbc.Driver

    错误描述: Caused by: java.lang.IllegalStateException: Cannot load driver class: com.mysql.cj.jdbc.Driver ...

  3. SpringBoot测试类启动错误 java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

    报错 java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Cont ...

  4. Jetty提交数据时报java.lang.IllegalStateException: Form too large270468>200000问题解决

    今天在使用Eclipse的Jetty插件做为服务器提交富文本编辑中的数据时,报如下异常: 在\eclipse\plugins目录下,找到org.mortbay.jetty.server_6.1.23. ...

  5. 安卓java.lang.IllegalStateException: The specified child already has a parent.解决方案

    在使用ViewPager的时候遇到一个错误java.lang.IllegalStateException: The specified child already has a parent. You ...

  6. java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    <TextView android:layout_width="fill_parent" android:layout_height="wrap_content&q ...

  7. java.lang.IllegalStateException:Web app root system property already set to different value 错误原因及解决 Log4j

    Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件.甚至是套接口 服务器.NT的事件记录器.UNIX Syslog守护进程等: ...

  8. android TimerTask 的简单应用,以及java.lang.IllegalStateException: TimerTask is scheduled already错误的解决方法【转】

    Android应用开发中常常会用到定时器,不可避免的需要用到 TimerTask 定时器任务这个类下面简单的一个示例演示了如何使用TimerTask这个示例演示了3秒未有触屏事件发生则锁屏(只是设置下 ...

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

随机推荐

  1. SpringMVC学习 -- IDEA 创建 HelloWorld

    SpringMVC 概述: Spring 为展现层提供的基于 MVC 实际理念的优秀 Web 框架 , 是目前最主流的 MVC 框架之一. 自 Spring3.0 发布及 2013 年 Struts ...

  2. Lesson 2

    周末重新学习了一下java,有了些新的体会 1.关于jdk, jre,and  JVM: Jdk: java development kit,面向开发人员的java开发工具包 Jre:java run ...

  3. [bzoj3226][Sdoi2008]校门外的区间——线段树

    题目 略 题解 直接套黄学长模板. Orz 代码 #include <bits/stdc++.h> using namespace std; #define ll long long #d ...

  4. thinkphp 导入微信小程序加密解密库

    第三方类库 第三方类库指除了 ThinkPHP 框架.应用项目类库之外的其他类库,一般由第三方系统或产品提供,如 Smarty.Zend 等系统的类库等. 前面使用自动加载或 import 方法导入的 ...

  5. C++异常~二 转

    Linux 下 C++ 异常处理技巧 处理固有语言局限性的四种技术 处理 C++ 中的异常会在语言级别上遇到少许隐含限制,但在某些情况下,您可以绕过它们.学习各种利用异常的方法,您就可以生产更可靠的应 ...

  6. HBase表操作

    相对于0.9.X版本,在HBase1.X版本对内部API改动比较大,例如连接部分类库变更,如下: 连接获取:org.apache.hadoop.hbase.HBaseConfiguration.cre ...

  7. 【Sqlite3】SQLITE3使用总结(转)

    原文转自 https://www.cnblogs.com/wenxp2006/archive/2012/06/04/2535169.html SQL语句操作 介绍如何用sqlite 执行标准 sql  ...

  8. 利用opencv自带源码,调试摄像头做人脸检测

    本文为原创作品,转载请注明出处 欢迎关注我的博客:http://blog.csdn.net/hit2015spring 和 http://www.cnblogs.com/xujianqing/ 作者: ...

  9. algorithm ch2 insertsort

    刚开始看到insertsort,思路就是使用新来的元素与前述已经排好序的元素比较.然后进行插入或者跳到下一次比较. 实现的代码如下: void InsertSort(int *pArray, int ...

  10. The Clean Architecture--一篇很不错的关于架构的文章

    翻译水平有限,见谅! Uncle Bob 13 Aug 2012 Architecture Craftsmanship Over the last several years we’ve seen a ...