2

I'm developing a spring API and I have an endpoint that receives a MultipartFile as parameter but in the production environment I'm receiving the following error in some cases:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.impl.IOFileUploadException: Processing of multipart/form-data request failed. java.io.EOFException

I'm using spring-boot-starter-tomcat:2.4.7 that uses tomcat:9.0.46

I'm having some difficulty to debug this error because it throws before the code starts so it never reaches the logs that I put.

Thank you. Regards.

João Durante
  • 273
  • 5
  • 14
  • Try turning on debug logging for Spring MVC by adding this to application.properties file "logging.level.org.springframework.web: DEBUG" – Arthur Klezovich Nov 04 '21 at 16:34

1 Answers1

3

If this does not happen all the time and only sometimes, its probably because the upload got interrupted ( browser got closed for example ). Therefore, there is nothing for you to change in the code.

You can get more details if you enable Spring MVC debug logging

application.properties

logging.level.org.springframework.web: DEBUG

Here's additional info about how you can efficiently log these kinds of errors.

Arthur Klezovich
  • 2,595
  • 1
  • 13
  • 17