1,公司項目需要通過web端需要讓用戶上傳文件。上傳單個文件沒有問題,但是用戶如果在上傳文件的地方放多個圖片就會無法上傳。查看日志
2017-09-20 18:21:44.272 ERROR 9915 --- [io-8080-exec-12] o.s.boot.web.support.ErrorPageFilter : Forwarding to error page from request [/information/edit] due to exception [Could not parse multipart ***servlet request; nested exception is java.lang.IllegalStateException: The m*ulti-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector]****
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.parseRequest(StandardMultipartHttpServletRequest.java:111) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:85) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:76) ~[spring-web-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1099) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.5.RELEASE.jar:4.3.5.RELEASE]
2,解決方法,看到提示maxpostsize,故去修改server.xml中的maxpostsize改為0了,還是不行。換句話說并不是這個問題。
3,環境說明:直接裸奔tomcat 前端沒有Nginx和apache,第2個就是項目用的框架spring boot
4,請問各位有什么好的講義方法,謝謝。
1 回答

有只小跳蛙
TA貢獻1824條經驗 獲得超8個贊
maxpostsize改為-1試下,不限制大小tomcat7開始就不能用等于0了,只能小于0
tomcat7.0.63(包含)之后:
maxPostSize The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes).
添加回答
舉報
0/150
提交
取消