0

I have a Spring Boot application where I fill in a generated form based on a certain file that the user has to upload. Somtimes in this file, a table can occur >100 times. When this is the case, whenever I try to submit the form, I get the error:

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.

I have tried solving this by adding the following code to my server.xml:

<Connector port="8080" protocol="HTTP/1.1"
 connectionTimeout="20000"
 redirectPort="8443" maxParameterCount="1000000"/>

As is stated in this post - set the maxParameterCount attribute on the Connector. But this doesn't seem to do anything.

My application is running on port 8081, but changing this in the connector code doesn't make any difference. I still get the error that my request exceeded 10 000 parameters.

Does anyone have an idea?

Thanks in advance.

Kind Regards

JensW
  • 442
  • 2
  • 12
  • 1
    What version of spring boot/tomcat do you use? Is it a separate tomcat instance or you use the one packed with spring boot? Where do you put the `server.xml`? – Sasha Shpota Jun 13 '19 at 07:31
  • Why would you modify the connector for port 8080, if you're using port 8081? If your file doesn't have a `` for port 8081, then you're obviously not looking at the right file. – Andreas Jun 13 '19 at 07:31
  • 1
    If using embedded Tomcat, see [How do I configure this property with Spring Boot and an embedded Tomcat?](https://stackoverflow.com/q/31461444/5221149) for how to add a `TomcatConnectorCustomizer` to call [`setMaxParameterCount`](https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/connector/Connector.html#setMaxParameterCount(int)) – Andreas Jun 13 '19 at 07:37
  • @OleksandrShpota I'm using spring v2.1.3 and then the embedded tomcat server yes. Server.xml is located in localhost-config for tomcat V8.0 – JensW Jun 13 '19 at 07:48
  • @Andreas I changed it to 8081 in that codeblock. But doesn't help. Leaving it at 8080 and running my application on localhost:8080 doesn't work either. – JensW Jun 13 '19 at 07:51
  • @JensW Hence my "you're obviously not looking at the right file", i.e. the actual definition of the connector in use in your application. Which is because you're using the embedded Tomcat, and it is configured in Java code, not in `server.xml`, and I already gave you the link for how to modify that configuration. – Andreas Jun 13 '19 at 07:57
  • @Andreas Hey Andres, Thanks for your reply. Looking at the link you posted, I tried putting that code in my application class, but TomcatEmbeddedServletContainerFactory and some other classes are not recognized and I can't import them. Sorry if this is a dumb question, but why is this? – JensW Jun 13 '19 at 08:01

0 Answers0