Spring Boot: Failed to parse multipart servlet request; nested exception is java.io.IOException

Here i am providing a quick resolution to the error thrown by container while uploading multipart content.


Root Causes:

Spring will use temp directory as a intermidiate location while doing multipart operation, container will create directory named tomcat.* to store files temporaraly. As temp location will be used by mutple application OS will perform cleaning on unused objects that have not been used for some days (ideally 10 days).


  • Restart your container so it will pick a new location automatically if old one has been deleted. (Not a good idea :))
  • Configure your custom temp location to handle mulitpart request using application properties. Example: spring.servlet.multipart.location=YOUR_TEMP_LOCATION_PATH or spring.http.multipart.location=YOUR_TEMP_LOCATION_PATH (Choose appropriate property based on your boot version)

Happy leaning:)