SpringMVC 上传报错:java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

时间:2022-10-22 19:55:16

SpringMVC 报错:
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

出错原因:没有引入apache的上传依赖

解决办法:
基于maven

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>