gpt4 book ai didi

java - 上传大文件时Spring启动java.net.SocketTimeoutException

转载 作者:行者123 更新时间:2023-11-28 22:10:30 25 4
gpt4 key购买 nike

我可以在我的应用程序中将文件上传到服务器,我在前端使用 angular 我正在使用这个库上传文件 ng2-file-upload ,我在后端使用 Spring boot,目前它适用于最大 1GB 的文件,但是对于更大的文件,我在上传时遇到了这个异常:

Caused by: java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.apache.catalina.connector.Request.parseParts(Request.java:2932) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.Request.parseParameters(Request.java:3232) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.Request.getParameter(Request.java:1137) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381) ~[catalina.jar:8.5.31]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 35 more
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. null
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:297) ~[tomcat-coyote.jar:8.5.31]
at org.apache.catalina.connector.Request.parseParts(Request.java:2884) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.Request.parseParameters(Request.java:3232) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.Request.getParameter(Request.java:1137) ~[catalina.jar:8.5.31]
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381) ~[catalina.jar:8.5.31]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:75) ~[spring-web-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 35 more
Caused by: java.net.SocketTimeoutException
at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:201) ~[tomcat-coyote.jar:8.5.31]
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:235) ~[tomcat-coyote.jar:8.5.31]
at org.apache.tomcat.util.net.NioSelectorPool.read(NioSelectorPool.java:216) ~[tomcat-coyote.jar:8.5.31]
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1250) ~[tomcat-coyote.jar:8.5.31]
at org.apache.tomcat.util.net.NioEnd

point$NioSocketWrapper.read(NioEndpoint.java:1193) ~[tomcat-coyote.jar:8.5.31]

似乎在上传服务器时收到了一个空请求,但我不确定,有人可以解释这个错误吗?

最佳答案

要调查此问题,您可以执行以下操作:
1.在application.properties中添加server.connection-timeout=-1属性,查看是否报错(-1表示无限超时)
2. 尝试在独立的 tomcat 上部署 war(据我所知,有时它的行为与嵌入到 springboot 中的不同)

关于java - 上传大文件时Spring启动java.net.SocketTimeoutException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52702304/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com