org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.6239989728636105816.19530/work/Tomcat/localhost/ROOT] is not valid
方法1
应用重启
方法2
增加服务配置,自定义baseDir
server.tomcat.basedir=/tmp/tomcat
方法3
注入bean,手动配置临时目录
@Bean
MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setLocation("/tmp/tomcat");
return factory.createMultipartConfig();
}
方法4
配置不删除tmp目录下的tomcat
vim /usr/lib/tmpfiles.d/tmp.conf
x /tmp/tomcat.*