提示 Form too large 的问题求教 setMaxPostSize无效

已经在configConstant中加入

me.setMaxPostSize(500*1024*1024);

但是测试时发现问题依旧,这个设置感觉没起作用:

java.lang.IllegalStateException: Form too large563632>200000

at org.eclipse.jetty.server.Request.extractParameters(Request.java:326)

at org.eclipse.jetty.server.Request.getParameter(Request.java:741)

at com.jfinal.core.Controller.getPara(Controller.java:119)


评论区

JFinal

2016-12-21 15:39

设置得更大些,错误提示 Form too large 563632>200000,还是小了,要注意不仅仅是上传文件,还有提交的参数也可能占用一点空间

toni

2016-12-21 20:56

WEB-INF 下添加 jetty-web.xml , 内容如下:
"http://jetty.mortbay.org/configure.dtd">

512000000

toni

2016-12-21 20:57

特殊字符被转义了。。

flash866

2016-12-23 18:39

@toni 我使用的是jetty做server,配置xml后,异常提示两者不是同一个loader...

flash866

2016-12-23 18:41

@JFinal 加大了一倍,好像还是没效果,我使用的是jetty做server,会不会和这个有关系?

JFinal

2016-12-23 18:45

按照 @toni 提供的解决办法试试,有可能是容器的问题,换 tomcat 测试一下立即可得知

flash866

2016-12-23 18:47

@JFinal 好的,我下载个TOMCAT试试看

JFinal

2016-12-23 19:04

@flash866 tomcat 下部署注意别掉坑里去,看下这篇博文:https://my.oschina.net/jfinal/blog/353062

flash866

2016-12-23 19:07

@JFinal 好的,多谢提醒

toni

2016-12-24 18:34

@flash866 一般web容器会对POST、GET操作时最大 字符内容作限制,jetty控制的最大值为 200000byte,可以在WEB-INF 下添加 jetty-web.xml 加入配置重写该值。tomcat 也有限制貌似为2M。都可以通过修改容器参数调整的。

JFinal

2016-12-24 19:16

@toni @flash866 验证楼主不是用的 multipart request ?

fmpoffice

2017-01-03 16:25

jetty 也需要修改不然无效,我觉得应该是jetty 的问题了。

fmpoffice

2017-01-03 17:45

@toni 加入了jetty-web.xml功能上能实现了,但是每次修改代码,自动重新编译发布之后,就会报错:
Loading changes ......
2017-01-03 17:44:30.472:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/E:/Workspaces/MyEclipse%202015/Jfinal_Seo_System/WebRoot/}
java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:330)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:288)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:103)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:466)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1245)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:108)
at com.jfinal.server.Scanner.compare(Scanner.java:88)
at com.jfinal.server.Scanner.working(Scanner.java:57)
at com.jfinal.server.Scanner.access$000(Scanner.java:31)
at com.jfinal.server.Scanner$1.run(Scanner.java:94)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
2017-01-03 17:44:30.472:WARN:oejuc.AbstractLifeCycle:FAILED o.e.j.w.WebAppContext{/,file:/E:/Workspaces/MyEclipse%202015/Jfinal_Seo_System/WebRoot/}: java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:330)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:288)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:103)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:466)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1245)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:108)
at com.jfinal.server.Scanner.compare(Scanner.java:88)
at com.jfinal.server.Scanner.working(Scanner.java:57)
at com.jfinal.server.Scanner.access$000(Scanner.java:31)
at com.jfinal.server.Scanner$1.run(Scanner.java:94)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Error reconfiguring/restarting webapp after change in watched files
一月 03, 2017 5:44:30 下午 com.jfinal.kit.LogKit error
严重: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.webapp.WebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:330)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:288)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:103)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:466)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1245)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.jfinal.server.JettyServer$1.onChange(JettyServer.java:108)
at com.jfinal.server.Scanner.compare(Scanner.java:88)
at com.jfinal.server.Scanner.working(Scanner.java:57)
at com.jfinal.server.Scanner.access$000(Scanner.java:31)
at com.jfinal.server.Scanner$1.run(Scanner.java:94)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

热门反馈

扫码入社