说明:

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. js 扒一扒这些题目都考了哪些知识点

    1.空数组是true还是false 题目: <script> var tmp = 'a'; if([]==false) tmp+='b'; if(![]) tmp +='c'; alert ...

  2. Shell之基本用法

    一:shell简介 1.什么是shell shell的中文意思是“外壳”,通俗地讲,shell是一个交互编程接口,通过获得用户输入来驱动操作系统内核完成指定工作.shell除了作为命令解释程序以外,还 ...

  3. 【洛谷 P2346】四子连棋(状态压缩,搜索)

    其实这题可以直接二进制状压做,1表示黑棋,0表示白棋,另外记录下2个空点的位置就行了. 具体看代码(冗长): #include <iostream> #include <cstdio ...

  4. Django-内置Admin

    Django内置的Admin是对于model中对应的数据表进行增删改查提供的组件,使用方式有: 依赖APP: django.contrib.auth django.contrib.contenttyp ...

  5. CentOS RabbitMQ安装

    1. 安装erlang,参考另外一篇文章: http://www.cnblogs.com/wanpengcoder/p/5287302.html 2. 安装libxslt和: yum install ...

  6. PL/SQL 09 包 package

    --定义包头 create or replace package 包名as  变量.常量声明;  函数声明;  过程声明;end; --定义包体 create or replace package b ...

  7. TCP,UDP,IP包头格式及说明(zz)

    一.MAC帧头定义 /数据帧定义,头14个字节,尾4个字节/ typedef struct _MAC_FRAME_HEADER { ]; //目的mac地址 ]; //源mac地址 short m_c ...

  8. 简单的curl抓取数据

    工欲善其事,必先利其器,数据抓取同样也是如此,PHP数据抓取常用CURL. CURL是一个使用libcurl库与各类服务器进行通讯,支持很多协议,如HTTP.FTP.TELNET等. curl_ini ...

  9. Square Number & Cube Number

    Square Number: Description In mathematics, a square number is an integer that is the square of an in ...

  10. 湖南师范大学2018年大学生程序设计竞赛新生赛 A 齐神和心美的游戏【hash】

    [链接]:A [题意]:给你n个数的序列和k.判断是否可以三个数组成k(同一个数可以拿多次) [分析]:每个数vis记录一下.2层循环.两数之和不超过k以及剩下的数出现在序列中那么ok. [代码]: ...