尝试从应用程序上下文解决“超过单个请求的最大请求参数数(GET加POST)”

时间:2016-02-01 20:30:24

标签: spring parameters jboss max system-properties

我在JBoss 7.1.3.Final上使用Spring 3.2.11.RELEASE。我正在构建一个WAR文件,我有一个页面提交一个包含512个以上参数的表单。这样做,我得到以下例外...

20:05:03,905 ERROR [org.mainco.springboard.session.util.SessionHelper] (ajp-/127.0.0.1:8009-29) More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.: java.lang.IllegalStateException: More than the maximum number of request parameters (GET plus POST) for a single request ([512]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
        at org.apache.tomcat.util.http.Parameters.addParameter(Parameters.java:199) [jbossweb-7.0.17.Final.jar:]
        at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:383) [jbossweb-7.0.17.Final.jar:]
        at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:229) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.connector.Request.parseParameters(Request.java:2874) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.connector.Request.getParameter(Request.java:1291) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:363) [jbossweb-7.0.17.Final.jar:]
        at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:180) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]
        at org.mainco.springboard.session.util.SessionHelper.getSessionId(SessionHelper.java:48) [core-88.0.0.jar:]
        at org.mainco.springboard.core.security.SpringboardSecurityContextRepository.loadContext(SpringboardSecurityContextRepository.java:69) [core-88.0.0.jar:]
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82) [spring-security-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) [spring-web-3.2.11.RELEASE.jar:3.2.11.RELEASE]
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) [spring-web-3.2.11.RELEASE.jar:3.2.11.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
        at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505) [jbossweb-7.0.17.Final.jar:]
        at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:453) [jbossweb-7.0.17.Final.jar:]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
        at java.lang.Thread.run(Thread.java:680) [rt.jar:1.6.0_65]

我试图将这个参数添加到我的Spring上下文中......

<bean id="systemPrereqs"
    class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject" value="#{@systemProperties}" />
    <property name="targetMethod" value="putAll" />
    <property name="arguments">
        <!-- The new Properties -->
        <util:properties>
            <prop key="org.apache.tomcat.util.http.Parameters.MAX_COUNT">1024</prop>
        </util:properties>
    </property>
</bean>

然而,尽管在我的应用程序中有这个,我仍然得到上述错误。如何通过更改应用程序来消除此问题?这个问题的重点是通过进行应用程序更改来实现这一点,如果有解决方案涉及重新配置JBoss,那么这很有用,但这不是我在这里要问的问题。

1 个答案:

答案 0 :(得分:1)

您需要将此添加到JBoss配置(standalone.xml),而不是Spring上下文。

$(function() {
     var pgurl = window.location.href.substr(window.location.href
.lastIndexOf("/")+1);
     $("#nav ul li a").each(function(){
          if($(this).attr("href") == pgurl || $(this).attr("href") == '' )
          $(this).addClass("active");
     })

看这里: http://www.javaquery.com/2013/12/javalangillegalstateexception-more-than.html