在用户实际
环境的tomcat日志(localhost_log.2009-06-22.txt)看到下面这个错
引用:
2009-06-22 12:39:41 StandardWrapperValve[ajax]: Servlet.service() for servlet ajax threw exception
java.lang.IllegalStateException: Post too large
at org.apache.coyote.tomcat5.CoyoteRequest.parseRequestParameters(CoyoteRequest.java:2405)
at org.apache.coyote.tomcat5.CoyoteRequest.getParameter(CoyoteRequest.java:1073)
at org.apache.coyote.tomcat5.CoyoteRequestFacade.getParameter(CoyoteRequestFacade.java:265)
at org.ajaxanywhere.AAUtils.isAjaxRequest(AAUtils.java:34)
at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.thunisoft.summer.web.filter.CharsetFilter.doFilter(CharsetFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
在另外一个catalina_log.2009-06-22.txt日志
文件中,有下面这句话
引用:
2009-06-22 12:39:41 CoyoteRequest Parameters were not parsed because the size of the posted data was too big. Use the maxPostSize attribute of the connector to resolve this if the application should accept large POSTs.
上网查了一下,说是tomcat默认接收的POST提交
数据最大为2M,如果没有修改过配置post提交的数据超过这个就报上面的错了。这个配置在%tomcat-5.0.28%conf\server.xml中的我们用到的connector节点的属性。其中tomcat的文档是这么描述的
引用:
maxPostSize
The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The feature can be disbled by setting this attribute to a value inferior or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
准备复现
问题,第一个想到的就是XX系统文书保存到
数据库,并且为ajax的post方式提交(文件上传不会报这个错)
代码:
var map = new Map();
map.put("key", "fy.doceditor.updateDoc");
map.put("jzjd", jzjd);
map.put("caseType", caseType);
map.put("caseId", caseId);
map.put("docId", docId);
map.put("wsxh", wsxh);
map.put("doc", docDetail);
var query = new QueryObj(map,updated);
query.send();
所以创建了一个文书,粘贴了一个8M的word文书,点保存之后报js错。把上面这个docDetail保存成文件,发现大小为7.94 MB (8,332,134 字节),检查日志有post too large错。
按照文档描述,修改xml文件配置如下:
引用:
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" maxPostSize="0"/>
问题得到解决。
一般来说大部分post提交都是没有问题的,但是还是要仔细考虑一下项目是否会出现这种情况,最好是修改一下tomcat的配置。有时候需要注意这个异常只会记录在tomcat的日志文件中。
posted on 2009-06-22 17:36
岁月如歌 阅读(1682)
评论(1) 编辑 收藏 所属分类:
java