0

I am switching a Spring Boot application's server from Tomcat to Jetty. I am unable to find any Jetty alternative for the org.apache.tomcat.util.http.fileupload.FileUploadException exception. This exception exists in the tomcat-coyote dependency, but if I add it, Tomcat will handle the HTTP requests instead of Jetty.

I am also concerned about other exceptions that are not present in Jetty, such as ClientAbortException. How should I deal with these exceptions during the transition?

  • Why are you even catching/handling those exceptions? Spring Boot wraps them in other generic exceptions you should handle. – M. Deinum Jul 28 '23 at 08:53
  • It's some legacy code i'm dealing with, which generic exception should i handle in this case – Aakash Bhatia Jul 28 '23 at 08:55
  • 1
    Without seeing the code that will be impossible to answer. When using `RestTemplate` you will have a `ClientException` of sorts. – M. Deinum Jul 28 '23 at 09:00
  • these are mostly used here for handling stuff like "org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: java.io.EOFException: Unexpected EOF read on the socket ", if i handle multipartException Directly, will that also work with jetty – Aakash Bhatia Jul 28 '23 at 09:03
  • 1
    You should be handling the `MultipartException` (the wrapper from Spring) which will work regardless of the container. – M. Deinum Jul 28 '23 at 09:04
  • Got your point,thank you so similarly, if i have org.apache.catalina.connector.ClientAbortException ,i should handle IOException instead? (i'm new to this ) – Aakash Bhatia Jul 28 '23 at 09:12
  • It depends, if you are unwrapping exceptions (like the multipart one) you should be handling the spring specific one. There is no rule of thumb here. – M. Deinum Jul 28 '23 at 09:26

0 Answers0