Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.7215026991249819883.8087/work/Tomcat/localhost/ROOT] is not valid
org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.7215026991249819883.8087/work/Tomcat/localhost/ROOT] is not valid
临时目录不存在,可能原因系统运行久了,临时文件目录被系统自动清除了
重启服务,重启后被删除的tomcat目录会重新生成
启动时增加参数-Djava.io.tmpdir=自定义目录
@Bean MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); //临时文件地址 factory.setLocation("/var/tmp"); return factory.createMultipartConfig(); }
tmpwatch 删除文件的逻辑
设置文件临时存储路径
spring.http.multipart.location = /var/tmp
server.tomcat.basedir=e:/tmp
上一篇:六个为Rust构建的IDE