IT猫扑网:您身边最放心的安全下载站! 最新更新|软件分类|软件专题|手机版|论坛转贴|软件发布

您当前所在位置:首页服务器WEB服务器 → tomcat5报Post too large的错

tomcat5报Post too large的错

时间:2015/6/28来源:IT猫扑网作者:网管联盟我要评论(0)

  在用户实际环境的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)

#p#副标题#e#

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

  准备复现问题,第一个想到的就是三期文书是保存到数据库的,并且为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的日志文件中(列如北高三期)。

关键词标签:tomcat5

相关阅读

文章评论
发表评论

热门文章 ISAPI Rewrite实现IIS图片防盗链ISAPI Rewrite实现IIS图片防盗链IIS6.0下配置MySQL+PHP5+Zend+phpMyAdminIIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin在Windows服务器上快速架设视频编解码器全攻在Windows服务器上快速架设视频编解码器全攻win2000server IIS和tomcat5多站点配置win2000server IIS和tomcat5多站点配置

相关下载

人气排行 XAMPP配置出现403错误“Access forbidden!”的解决办法WIN2003 IIS6.0+PHP+ASP+MYSQL优化配置访问网站403错误 Forbidden解决方法Server Application Unavailable的解决办法如何从最大用户并发数推算出系统最大用户数报错“HTTP/1.1 400 Bad Request”的处理方法http 500内部服务器错误的解决办法(windows xp + IIS5.0)Windows Server 2003的Web接口