spring boot 线上故障 上传文件出错:org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request;


spring boot 线上故障 上传文件出错:异常org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.4969464838095977377.9999/work/Tomcat/localhost/ROOT] is not valid

原因是:springboot应用服务再启动(java -jar 命令启动服务)的时候,会在操作系统的/tmp目录下生成一个tomcat*的文件目录,上传的文件先要转换成临时文件保存在这个文件夹下面。由于临时/tmp目录下的文件,在长时间(10天)没有使用的情况下,就会被系统机制自动删除掉。所以如果系统长时间无人问津的话,就可能导致上面这个问题。

解决:

application.properties配置文件中添加:

server.tomcat.basedir=/tmp

手动的将临时文件夹设置为自定义的文件夹,就不会被删除了。

待测试

 原文:https://blog.csdn.net/shaojianjun521/article/details/87688643


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 spring boot 上传文件出错:org.springframework.web.multipart.MultipartException: Could not parse multipart s org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: 临时上传路径[D:\tomcat\work\Catalina\localhost\ROOT]无效 org.springframework.web.multipart.MultipartException: The current request is not a multipart request org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.1428942566812653608 文件上传报错:Could not parse multipart servlet request;找不到路径问题解决 SpringMVC使用MultipartFile上传文件报错【org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.multipart.MultipartFile]: Specified class is an interface】 SpringBoot 上传文件突然报错 Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.1428942566812653608 [WARNING] Resolved [org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'myFile' is not present]已解决+1 后台报错:org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file_data' is not present org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM