An error is reported when uploading a file using commonsmultipartfile

Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

An error is reported when uploading a file using commonsmultipartfile. The error is due to the following reasons: the corresponding jar package of Commons IO is missing

The solution is to import the dependencies of Commons IO in POM. Update the classes jar package and import it successfully

Just run the program

An error is reported when uploading a file using commonsmultipartfile

Errors are reported as follows

HTTP status 500 – internal server error

Type exception report

Message handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream

Description the server encountered an unexpected condition that prevented it from completing the request.

Exceptions

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1006)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
org.springframework.web.servlet.FrameworkServlet.proc essRequest(FrameworkServlet.java:974)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
or g.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

reason

The corresponding jar package of Commons IO is missing

terms of settlement

Import common IO dependency in POM

Update the classes

The jar package was imported successfully

Just run the program

Read More: