说明:

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. springMvc4+hibernate4+activiti5.15(Maven)

    首先创建activiti表 方式1.用代码创建 package createtable; import org.activiti.engine.ProcessEngineConfiguration; ...

  2. vivo面试学习1(io和nio)

    一.io流(一次从open到底层的操作) 输入和输出流 IO流 字节流 Reader.Writer 字符流 InputStream.OutputStream 字节流:可以处理所有bit为单位存储的文件 ...

  3. HDU 4320 Arcane Numbers 1 (数论)

    A - Arcane Numbers 1 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64 ...

  4. 【POJ 1719】 Shooting Contest (二分图匹配)

    题目链接 把每一列能射的两行和这一列连边,然后跑一边匈牙利就行了. #include <cstdio> #include <cstring> #include <algo ...

  5. bzoj 2142 国家集训队试题 礼物

    问题转化成求C(N,M) mod P p为非素数,那么我们可以将P分解质因数, 也就是 π pi^ci的形式,因为这些pi^ci是互质的,所以我们可以用crt将他们合并 那么问题就转化成了快速求C(N ...

  6. Linux MMC介绍

    1. 介绍 Linux中,将包括MMC.SD.SDIO统称为MMC子系统 MMC子系统从功能上可分为三个层次 - card层: Card驱动, 或称client驱动 - core层: MMC的核心层, ...

  7. Kuangbin 带你飞-线段树专题 题解

    HDU 1166 敌兵布阵 单调更新区间查询和 #include <map> #include <set> #include <list> #include < ...

  8. npm编译报错,缺少组件

    解决方式: 1.删除安装文件 node_modules: 2.在需要安装 node_modules 文件的文件夹中,打开命令窗口,输入: cnpm install: 3.再输入: npm start, ...

  9. Django基础之模板

    Django模板系统 官方文档 常用语法 只需要记两种特殊符号: {{  }} 和 {% %} 变量相关的用{{ }},逻辑相关的用{% %}. 变量 {{ 变量名 }} 变量名由字母数字和下划线组成 ...

  10. poj 3608(旋转卡壳求解两凸包之间的最短距离)

    Bridge Across Islands Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9768   Accepted: ...