我正在尝试一个使用maven在spring MVC中上传文件的简单示例,我遵循了这个tutorial。
但是我得到了这个错误
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
我还在pom.xml中包含了依赖项。
<!-- Apache Commons Upload -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
也在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>
那么,你能帮我指出我哪里错了吗?
提前谢谢。
发布于 2011-03-02 19:38:44
您需要添加commons-fileupload
将此添加到您的POM
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version> <!-- makesure correct version here -->
</dependency>
https://stackoverflow.com/questions/5166898
复制相似问题