Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.2787723636027878371.8082/work/Tomcat/localhost/taslyb2bbms] is not valid "
Problem Description: spring boot by MultipartFile upload files, two client computers, client A today can properly transfer files, and B can not transfer files, tomorrow A client can not transfer files properly and B may be.
results: see no error is because the temporary directory to upload files lead to failure, temporary file does not exist is because linux automatically 10 days to clean up temporary files directory is not operating, and two clients sometimes can not be a problem because sometimes, using load balancing two servers, one server is not allocated due 10 days the visit resulted in the temporary directory to be cleaned up, while the other is not received access to clean temporary directory, so when no matter which server the client is assigned a temporary directory access is not cleaning up properly can upload files, and another it can not upload files to normal
solutions in three ways:
1 restart project, the system will Automatically rebuild the directory
2 manually create the directory
3 increase in code default directory configuration, as follows:
@Bean
MultipartConfigElement multipartConfigElement () {
MultipartConfigFactory new new MultipartConfigFactory Factory = ();
factory.setLocation ( "/ App / tmp");
return factory.createMultipartConfig();
}
Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary up
Guess you like
Origin www.cnblogs.com/zhuyeshen/p/12197119.html
Recommended
Ranking