[英]java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
I am trying a simple example of file upload in spring MVC using maven and I follwed this tutorial .我正在使用 maven 在 spring MVC 中尝试一个简单的文件上传示例,我遵循了本教程。
But I am getting this error但我收到此错误
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
I also included the dependencies in pom.xml我还在 pom.xml 中包含了依赖项
<!-- Apache Commons Upload -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
also in dispatcher-servlet.xml也在 dispatcher-servlet.xml 中
<!-- Configure the multipart resolver -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="100000"/>
</bean>
So, can you help me where I am going wrong.所以,你能帮我哪里出错了。
Thanks in advance.提前致谢。
You need to add commons-fileupload
您需要添加
commons-fileupload
add this to your POM将此添加到您的 POM
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version> <!-- makesure correct version here -->
</dependency>
For the security use version 1.4 :
对于安全使用版本 1.4 :
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
Check : https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload检查: https : //mvnrepository.com/artifact/commons-fileupload/commons-fileupload
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.