SpringBoot Openshift POST io.undertow.util.ParameterLimitException: UT000047: 参数个数超过最大值1000
SpringBoot Openshift POST io.undertow.util.ParameterLimitException: UT000047: The number of parameters exceeded the maximum of 1000
我有一个部署在 RedHat OpenShift 上的 spring 引导应用程序。每当我有一个大的 POST 请求(~11000 行)时,我都会收到此消息。
java.lang.RuntimeException: io.undertow.util.ParameterLimitException: UT000047: The number of parameters exceeded the maximum of 1000
at io.undertow.server.handlers.form.FormData.add(FormData.java:95) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormData.add(FormData.java:85) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.doParse(FormEncodedDataDefinition.java:173) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.parseBlocking(FormEncodedDataDefinition.java:252) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:825) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.spec.HttpServletRequestImpl.getParameter(HttpServletRequestImpl.java:704) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:161) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:84) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114) ~[spring-boot-actuator-2.1.6.RELEASE.jar!/:2.1.6.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104) ~[spring-boot-actuator-2.1.6.RELEASE.jar!/:2.1.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletChain.handleRequest(ServletChain.java:68) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.GracefulShutdownHandler.handleRequest(GracefulShutdownHandler.java:69) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access0(ServletInitialHandler.java:81) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:138) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:135) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access[=12=]0(ServletInitialHandler.java:81) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:104) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) [undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.HttpServerExchange.run(HttpServerExchange.java:830) [undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
请求 json 在具有 3 个列表的请求对象中进行解析。这 3 个列表不超过 1000 个元素,即使它们按以下方式分组。
它甚至没有进入控制器。
我试图在 yml 文件中添加此 属性 但保存的 json 文件有 245kb,即使使用此 属性 它也不会 运行.
server:
tomcat:
max-http-post-size: 100000000 # max-http-form-post-size: 10MB for new version
而且我还为 standalone.xml 文件找到了一个 属性,但我不知道如何将它包含在 yml 文件中
<http-listener name="default" socket-binding="http" max-parameters="5000"/>
谢谢
看来您使用的是 undertow 服务器,因此请尝试使用 server.tomcat.max-http-post-size
属性 而不是:
server.undertow.max-http-post-size
代替。
Here 您可以找到所有可以通过 spring 应用程序文件配置的 undertow 属性的列表(只需搜索 undertow
)。以下是其中一些:
Name
Description
server.undertow.max-cookies
Maximum number of cookies that are allowed. This limit exists to prevent hash collision based DOS attacks.
server.undertow.max-headers
Maximum number of headers that are allowed. This limit exists to prevent hash collision based DOS attacks.
server.undertow.max-parameters
Maximum number of query or path parameters that are allowed. This limit exists to prevent hash collision based DOS attacks.
我有一个部署在 RedHat OpenShift 上的 spring 引导应用程序。每当我有一个大的 POST 请求(~11000 行)时,我都会收到此消息。
java.lang.RuntimeException: io.undertow.util.ParameterLimitException: UT000047: The number of parameters exceeded the maximum of 1000
at io.undertow.server.handlers.form.FormData.add(FormData.java:95) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormData.add(FormData.java:85) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.doParse(FormEncodedDataDefinition.java:173) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.parseBlocking(FormEncodedDataDefinition.java:252) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:825) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.spec.HttpServletRequestImpl.getParameter(HttpServletRequestImpl.java:704) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:161) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:84) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114) ~[spring-boot-actuator-2.1.6.RELEASE.jar!/:2.1.6.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104) ~[spring-boot-actuator-2.1.6.RELEASE.jar!/:2.1.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar!/:5.1.8.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletChain.handleRequest(ServletChain.java:68) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) ~[undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.GracefulShutdownHandler.handleRequest(GracefulShutdownHandler.java:69) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access0(ServletInitialHandler.java:81) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:138) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:135) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access[=12=]0(ServletInitialHandler.java:81) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:104) [undertow-servlet-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) [undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at io.undertow.server.HttpServerExchange.run(HttpServerExchange.java:830) [undertow-core-2.0.21.Final.jar!/:2.0.21.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
请求 json 在具有 3 个列表的请求对象中进行解析。这 3 个列表不超过 1000 个元素,即使它们按以下方式分组。
它甚至没有进入控制器。
我试图在 yml 文件中添加此 属性 但保存的 json 文件有 245kb,即使使用此 属性 它也不会 运行.
server:
tomcat:
max-http-post-size: 100000000 # max-http-form-post-size: 10MB for new version
而且我还为 standalone.xml 文件找到了一个 属性,但我不知道如何将它包含在 yml 文件中
<http-listener name="default" socket-binding="http" max-parameters="5000"/>
谢谢
看来您使用的是 undertow 服务器,因此请尝试使用 server.tomcat.max-http-post-size
属性 而不是:
server.undertow.max-http-post-size
代替。
Here 您可以找到所有可以通过 spring 应用程序文件配置的 undertow 属性的列表(只需搜索 undertow
)。以下是其中一些:
Name | Description |
---|---|
server.undertow.max-cookies | Maximum number of cookies that are allowed. This limit exists to prevent hash collision based DOS attacks. |
server.undertow.max-headers | Maximum number of headers that are allowed. This limit exists to prevent hash collision based DOS attacks. |
server.undertow.max-parameters | Maximum number of query or path parameters that are allowed. This limit exists to prevent hash collision based DOS attacks. |