参考:
http://www.cnblogs.com/yg_zhang/p/4248061.html
https://my.oschina.net/luckyi/blog/213209
https://developer.jboss.org/thread/177942
https://developer.jboss.org/thread/198502
总结下来 Jboss6 配置:
need to set logging level of org.apache.catalina to DEBUG, then you will see the following line during the reproduction of the defect.
20:10:52,456 DEBUG [org.apache.catalina.connector] (http-/0.0.0.0:8080-6) JBWEB001023: 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.
standalone.xml
设置整个表单的 size ,设置太大,有被攻击的风险
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" max-post-size="2147483647" max-save-post-size="2147483647" />
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true" max-post-size="2147483647" max-save-post-size="2147483647">
<ssl name="ssl" key-alias="company" password="12345" certificate-key-file="${jboss.server.config.dir}/ssl.keystore" />
</connector>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
设置表单提交的时候 field 的数量
<system-properties>
<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="5000"/>
</system-properties>
-----------------------------------------------------------------------------------------------------------------------------------
在流程审批过程中,提交审批时发现使用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的方式提交,只提交部分参数就可以了。
In standalone.xml add the following lines
<system-properties>
<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="5000"/>
</system-properties>
分享到:
相关推荐
apache 集成 jboss 或者 tomcat 必须文件,window下专用
jobss4.0 和tomcat5.5的数据源配置,是我自己配置过程中写下来的,在网上看了好多,总算配成功了,希望大家喜欢.
JBOSS+TOMCAT集成开发环境。完整版
web工程从TOMCAT移植到JBOSS中
java项目tomcat迁移到jboss 出现的问题
JBoss+Tomcat已经成为一个免费的开源的稳定的J2EE服务器,虽然在JBoss中部署J2EE没有商用J2EE服务器那么方便,基本都是通过手工编写XML配置文件,但是这样可以让我们更容易理解J2EE的来龙去脉。本文以Jboss 2为例,...
Apache Jboss/Tomcat集群(手稿) Apache Jboss/Tomcat集群(手稿) Apache Jboss/Tomcat集群(手稿) Apache Jboss/Tomcat集群(手稿) Apache Jboss/Tomcat集群(手稿)
Servlet引擎:JBoss与Tomcat、Jetty协同工作
Tomcat应用也算非常广泛的web 服务器,支持部分j2ee,免费,出自 apache基金组织 JBoss开源的应用服务器,比较受人喜爱,免费(文档要收费) weblogic应该说算是业界第一的app server,全部支持j2ee1.4, 对于...
jBoss+tomcat学习笔记大全,jBoss+tomcat的帮助文档
JBOSS\Tomcat最大连接数配置和jvm内存配置,解决内存溢出问题 Java中OutOfMemoryError(内存溢出)的情况 第一种OutOfMemoryError: PermGen space 第二种OutOfMemoryError: Java heap space
Jboss与Tomcat服务器的SSL配置Jboss与Tomcat服务器的SSL配置
TOMCAT项目转成JBOSS项目的步骤
公司需要做 Apache Tomcat集群,研究了数日,终配置成功,把研究结果共享一下。 最下面的红色字体[在一台机器上启动两个JBoss服务器],不同机器端口和路径不同,可根据自己情况适当修改。
JBoss 下配置 Oracle 数据源
jboss4版本下,jbossweb-tomcat55.sar升级包,修复Apache Tomcat DIGEST身份验证多个安全漏洞(CVE-2012-3439) 升级包中的jar来源于tomcat5.5.36 使用方法:直接替换jboss中旧的jbossweb-tomcat55.sar
tomcat 和jboss 的区别基于Tomcat内核基于Tomcat内核的JBoss在J2EE应用服务器领域已成为发展最为迅速的应用服务器Tomcat的区别又在哪里
tomcat、jboss 连接池配置,详细步骤,准确代码,让你实践中学会这两种服务器的连接池配置
tomcat转化为jboss之前遇到过,弄了很久终于解决了,现在把所有资料整理到了一起,包括解决在集成中会遇到的问题,所要添加的jar包、删除的jar包等等
如何将代码从Tomcat迁移到JBoss