TOMCAT在POST方法提交参数丢失问题

最近写程序发现post参数接收不到了,jdk,eclipse,jar包,换了多次都不行,后来看到网上一篇文章:

 

随后设置Tomcat中POST方式提交数据大小: 
maxPostSize="0" 
修改后提交数据依然会出错,但给出了错误提示: 
信息: 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. 
按照错误提示在在Connector 节点中加入maxParameterCount="-1",再进行测试便成功了。 
<Connector executor="tomcatThreadPool" 

               port="9080" 

               protocol="HTTP/1.1" 

                maxParameterCount="-1" 

               connectionTimeout="20000" 

               acceptCount="75" 

               disableUploadTimeout="true" 

               enableLookups="false" 

               URIEncoding="UTF-8" /> 

maxParameterCount: 

The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 10000 by default. A value of less than 0 means no limit. 
查询网上资料了解到引起该问题是 
由于Java中的哈希表实现上的漏洞,现如今因为Tomcat使用了哈希表来存储HTTP请求参数,因此也受此问题影响。 

为此Tomcat实现了一个变通的做法,提供一个新的选项maxParameterCount用来限制但请求中最大的参数数量,该参数默认值是10000,这对多数应用程序来说已经足够,这个值也足够用来绕过JRE中的哈希表的bug。 

如果你正在使用早期的Tomcat版本(Apache Tomcat 5.x,Apache Tomcat 6.x,Apache Tomcat 7.x),没有maxParameterCount属性,那么可以通过限制maxPostSize到10kb以下来解决这个问题。 


也可以升级到5.5.35, 6.0.35或7.0.23及以上版本使用maxParameterCount属性进行处理。

 

 

后来在tomcat9里面也遇到了这个问题,把maxPostSize="-1" 原来是0,之后就能获取到参数了。

转载于:https://www.cnblogs.com/sunyuhua/p/10761034.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值