17

I get this error:

Exception during request processing:
Caused by javax.servlet.ServletException with message:
"Parameter count exceeded allowed maximum: 512"

There seems to be a limit on the number of parameter passed in a post.

How could I extend this limit in JBoss?

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
Giant2
  • 461
  • 1
  • 4
  • 15
  • 2
    The question has been answered before on serverfault: [Is there a maximum size for content of an HTTP POST?](http://serverfault.com/q/151090). Also, this question is not Java related (nor the technology stack you post). – Luiggi Mendoza Sep 05 '12 at 08:20
  • ok. So why I reach this error? Exception during request processing: Caused by javax.servlet.ServletException with message: "Parameter count exceeded allowed maximum: 512". I use Jboss 7 and need to deploy my app even on others... So how can it could be solved? @Luiggi Mendoza in the post you linked there is no answer about this! – Giant2 Sep 06 '12 at 08:03
  • @Giant2: Please include such vital information in your question in the future. – Aaron Digulla Sep 06 '12 at 08:19

5 Answers5

22

The number of parameters was limited in all web servers to plug the hashmap collision denial of service attack.

You can raise the limit by adding the following system property to the configuration file (e.g. standalone.xml):

<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="10000"/>

(source)

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
9

Just in case : for a plain Tomcat the corresponding solution is to add :

org.apache.tomcat.util.http.Parameters.MAX_COUNT=10000

in catalina.properties

bwt
  • 17,292
  • 1
  • 42
  • 60
  • I am using Tomcat 6 and don't have this parameter in catalina.properties. I can still post more than 600 parameters without this error occuring. I added this line to catalina.properties `org.apache.tomcat.util.http.Parameters.MAX_COUNT=100` because I want to simulatie this error. Restarted Tomcat but I can still post more than 600 post parameters. How can I simulatie this error in Tomcat 6? – A.W. Jan 11 '17 at 08:27
5

Yes, it is right! Mr Aaron Digulla had right answer!
But please attention that: in Jboss 7, please insert the line

<system-properties>
<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT"value="10000"/> </system-properties>

right after the <extensions> tag, if not Jboss 7 will through error when parse standalone.xml, let me example:

<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.2">
<extensions>
    <extension module="org.jboss.as.clustering.infinispan"/>
    <extension module="org.jboss.as.configadmin"/>
    ...
</extensions>
<system-properties>
    <property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="10000" />
</system-properties>
solendil
  • 8,432
  • 4
  • 28
  • 29
Trong-Hieu Tran
  • 111
  • 1
  • 7
  • I dont't have `standalone.xml` but `web.xml`, how can I set MAX_COUNT in my `Grails` project? can you please help me – Asif Jun 01 '21 at 05:53
0

Another way if you're using WildFly is edit the standalone.xml file and add max-parameters:

<http-listener name="default" socket-binding="http" max-parameters="2690"/>

standalone.xml example:

...

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
   <buffer-cache name="default"/>
   <server name="default-server">
       <!-- change here-->
       <http-listener name="default" socket-binding="http" max-parameters="2690"/>
       <!-- change here-->
       <host name="default-host" alias="localhost">
           <location name="/" handler="welcome-content"/>
           <filter-ref name="server-header"/>
           <filter-ref name="x-powered-by-header"/>
       </host>
    </server>

...
ℛɑƒæĿᴿᴹᴿ
  • 4,983
  • 4
  • 38
  • 58
  • I dont't have standalone.xml but web.xml, how can I set MAX_COUNT in my Grails project? – Asif Jun 01 '21 at 06:04
0

You need to paste the following snippet in your standalone.xml of Jboss server :

<server name="default-server">
                <http-listener name="default" socket-binding="http" max-parameters="5000"/>
                <https-listener name="https" socket-binding="https" max-parameters="5000"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>

Focus on HTTP Listener tag with max-parameter value is what make the difference. The Default value for this field is:-

org.apache.tomcat.util.http.Parameters.MAX_COUNT=1000

This was done as a remedy to the hashmap collision denial of service attack as discussed here