A file upload that was always working suddenly stopped working one day.
application.log
ERROR 39865 --- [http-nio-20080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException:
The temporary upload location [/tmp/tomcat.12071915071708668548.20080/work/Tomcat/localhost/ROOT] is not valid] with root cause
The OS deleted the directory used by Spring embedded Tomcat as a temporary folder (WORK when uploading files, etc.). .. (It was covered with the directory to be deleted by the OS) Therefore, suddenly there is no temporary folder to use when uploading. This time I was using CentOS. In the case of embedded Tomcat, the temporary folder is created in /tmp/tomcat.xxxxxx by default (automatically generated when tomcat starts).
Change temporary folder from / tmp
application.yml
server:
tomcat:
basedir: /xxx/xxxx/xxxx #Specify the path here
Recommended Posts