http://www.bubuko.com/infodetail-976418.html

http://www.cnblogs.com/yg_zhang/p/4248061.html

tomcat中间件提交表单数据量过大警告处理方案

时间:2015-07-16 22:35:19      阅读:1348      评论:0      收藏:0      [点我收藏+]

标签:instead   maximum number   中间件   000])   more than the maximum number of request parameters (get plus post) for a single request ([10

昨天系统出现了一个比较奇怪的BUG,表单提交后,数据没有全部执行。

查看tomcat日志发现有以下警告:

18:52:23,058  WARN HttpMethodBase:682 - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.

18:52:31,290  WARN HttpMethodBase:682 - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.

18:52:36,233  WARN HttpMethodBase:682 - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.

Jul 15, 2015 6:53:10 PM org.apache.tomcat.util.http.Parameters processParameters

INFO: More than the maximum number of request parameters (GET plus POST) for a single request ([10,000]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.

Note: further occurrences of this error will be logged at DEBUG level.

查询相关资料后,发现是因为tomcat有提交参数的限制。

修改tomcat  conf/server.xml文件,添加:

<Connector executor="tomcatThreadPool"

port="9080"

protocol="HTTP/1.1"

maxParameterCount="-1"

connectionTimeout="20000"

URIEncoding="UTF-8" />

########################################################################################################################

在流程审批过程中,提交审批时发现使用request.getParameter(“taskId”)获取数据时,发现取得任务ID为空。

在调试的过程中我发现表单的数据量特别大。

到网上查询了一下,说post  提交数据数据量有限制。

于是写了个表单测试了一下:

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%
String taskId=request.getParameter("taskId");
String name=request.getParameter("name");
System.out.println(taskId); System.out.println(name);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<form name="frmSubmit" method="post">
<input type="text" name="taskId">
<textarea rows="30" cols="200" name="name"></textarea>
<input type="submit" value="submit">
</form>
</body>
</html>

测试结果是,如果数据超过2MB的时候数据时获取不到了。是两个表单都获取不到数据,然后修改tomcat 连接参数。

<Connector   maxPostSize="0" URIEncoding="utf-8" connectionTimeout="20000"  port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

将maxPostSize修改为0则不显示post数据大小。

发现还是没有解决之前的问题。

在调试的过程中发现,服务器打印了如下信息。

信息: More than the maximum number of request parameters (GET plus POST) for a single request ([10,000]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.

搜索了一下这个告警信息。

原来是服务器对提交的参数做了限制,tomcat 文档描述如下:

The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. A value of less than 0 means no limit. If not specified, a default of 10000 is used. Note that FailedRequestFilter filter can be used to reject requests that hit the limit.

这个默认值为10000个,如果超过了10000个那么就丢弃。这也就解释了为什么我把taskId提前到form标签后,数据能够获取到。

知道了 原因:

我们修改tomcat配置如下:

<Connector maxParameterCount="-1"  maxPostSize="0" URIEncoding="utf-8" connectionTimeout="20000"  port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

不限制参数大小和提交数据大小,这样重新审批就没有问题了。

当然这个解决办法不是很好,因为他会极大的消耗服务器性能,因为提交的参数超过了10000个。

解决的办法是不提交那么的表单,这个我们这个表单系统中是可以的。

因为我们没有必要提交那么多的参数,我们的数据都拼装成了一个json进行提交,这样对服务器性能会 有极大的提升。

将我们的程序修改成使用ajaxpost的方式提交,只提交部分参数就可以了。

tomcat中间件提交表单数据量过大警告处理方案的更多相关文章

  1. jsp提交表单数据乱码,内置对象,以及过滤器

    jsp提交表单数据乱码解决方案 通过form表单给服务器提交数据的时候,如果提交的是中文数据,那么可能会出现乱码,如果表单的请求方式是post请求,那么可以使用如下方案解决乱码: 在调用getPara ...

  2. ASP.NET 程序提交表单数据中带有html标签不能提交或者提交报错问题

    今天在公司做另外的一个项目,又奇葩的遇到一个问题. 在本地自己电脑上怎么测试都是正常的.但是先上服务器就出问题: 用富文本编辑器上传一篇文章,始终报错,又没提示具体什么错误,也没说代码错误,点击提交按 ...

  3. JSON编码格式提交表单数据详解

    以JSON编码格式提交表单数据是HTML5对WEB发展进化的又一大贡献,以前我们的HTML表单数据是通过key-value方式传输的服务器端,这种形式的传输对数据组织缺乏管理,形式十分原始.而新出现的 ...

  4. easyui提交表单数据的时候如何防止二次提交

    在前端提交数据的时候有时候可能会由于网络延迟等原因,我们在等待的时候会多次点击保存按钮,这可能会导致我们一次输入的数据多次提交,导致数据重复.最近在做项目的时候碰到了这个问题,先说一点,这个问题的解决 ...

  5. Spring Boot(三):RestTemplate提交表单数据的三种方法

    http://blog.csdn.net/yiifaa/article/details/77939282 ********************************************** ...

  6. PoiDocxDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0),目前只能java生成】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 这个是<PoiDemo[Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)]>的扩展,上一篇是根 ...

  7. PoiDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 使用Poi实现android中根据模板文件生成Word文档的功能.这里的模板文件是doc文件.如果模板文件是docx文件的话,请阅读 ...

  8. Android根据word模板文档将表单数据生成word文档的方案整理

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 尝试的方案包括以下几种: freemarker 只能在java项目上运行,无法在Android项目上运行: 参考资料:<Fre ...

  9. jquery ajax异步提交表单数据的方法

    使用jquery的ajax方法可以异步提交表单,成功后后台返回json数据,回调函数处理,可以不用刷新页面,达到异步的目的: 处理表单的数据可以用serialize()方法进行序列化,而如果提交的数据 ...

随机推荐

  1. C#获取本地磁盘信息【转载】

      直接上干货简单易懂 //磁盘监控(远程/本地)//需要引用System.Management.dllpublic class RemoteMonitoring{private static str ...

  2. 网易2019校招内推编程题-瞌睡-C++实现

    [编程题] 瞌睡 时间限制:1秒 空间限制:262144K 小易觉得高数课太无聊了,决定睡觉.不过他对课上的一些内容挺感兴趣,所以希望你在老师讲到有趣的部分的时候叫醒他一下.你知道了小易对一堂课每分钟 ...

  3. QEMU模拟器Windows版本模拟ARMX86CPU指令

    http://qemu.weilnetz.de/ QEMU Binaries for Windows

  4. Django 1.9 + celery + django-celry 实现定时任务

    celery可以进行任务异步处理,celery还有一种Celery的常用模式便是执行定期任务. 执行定期任务时, Celery会通过celerybeat进程来完成. Celerybeat会保持运行, ...

  5. .Net memory management Learning Notes

    Managed Heaps In general it can be categorized into 1) SOH and 2) LOH.  size lower than 85K will be ...

  6. where 常用条件范例

    where() public method Sets the WHERE part of the query. The method requires a $condition parameter, ...

  7. WEBBASE篇: 第十篇, JavaScript知识5

    JavaScript知识5 <!doctype html> <html lang="en"> <head> <meta charset=& ...

  8. ODI Scenario 场景

    ODI中,场景的作用类似发布版本,当映射最终修改版完成时,可以生成场景.无论是映射(Mapping)还是包(Package)都可以生成场景. 包调用映射和调用场景的区别: 1,包直接调用映射,当映射修 ...

  9. Oracle数据导入Hbase操作步骤

    ——本文非本人原创,为公司同事整理,发布至此以便查阅 一.入库前数据准备 1.入hbase详细要求及rowkey生成规则,参考文档“_入HBase库要求 20190104.docx”. 2.根据标准库 ...

  10. 如何配置Tomcat以使用Apache httpd?

    How to Connect Tomcat 6 to Apache HTTP Server 2 Tomcat can be run as a standalone server. Tomcat can ...