完整异常信息

org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [spring] in context with path [/jsgc] threw exception [Request processing failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'tpbidresults[2048]' of bean class [cn.pinming.notice.entity.TPNotice]: Index of out of bounds in property path 'tpbidresults[2048]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 2048, Size: 2048] with root cause
	java.lang.IndexOutOfBoundsException: Index: 2048, Size: 2048
		at java.util.ArrayList.rangeCheck(ArrayList.java:657)
		at java.util.ArrayList.get(ArrayList.java:433)
		at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyValue(AbstractNestablePropertyAccessor.java:652)
		at org.springframework.beans.AbstractNestablePropertyAccessor.getNestedPropertyAccessor(AbstractNestablePropertyAccessor.java:836)
		at org.springframework.beans.AbstractNestablePropertyAccessor.getPropertyAccessorForPropertyPath(AbstractNestablePropertyAccessor.java:813)
		at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:270)
		at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
		at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:834)
		at org.springframework.validation.DataBinder.doBind(DataBinder.java:730)
		at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:189)
		at org.springframework.web.bind.ServletRequestDataBinder.bind(ServletRequestDataBinder.java:106)
		at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.bindRequestParameters(ServletModelAttributeMethodProcessor.java:150)
		at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:110)
		at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:99)
		at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)
		at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)
		at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
		at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
		at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
		at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
		at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
		at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
		at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
		at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870)
		at javax.servlet.http.HttpServlet.service(HttpServlet.java:682)
		at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
		at javax.servlet.http.HttpServlet.service(HttpServlet.java:765)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

原因解释

Spring接受前台数据超过2048出现如下异常前台的Form 元素绑定后台的JaveBean对象,做的一个映射,但是这个映射的List长度不可以超过2048

溯源了下Spring的代码找到了DataBinder,先解释下DataBinder类的作用,见链接
链接: http://docs.spring.io/spring/docs/1.2.x/api/org/springframework/validation/DataBinder.html
可以controller 规定 长度即可

解决方案

@InitBinder
public void initBinder(WebDataBinder binder) {

    binder.setAutoGrowCollectionLimit(**2048**);
}

原文地址:https://blog.csdn.net/qq_33578833/article/details/134752450

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_48386.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注