I'm trying to use commons-fileupload module by including its dependency in pom.xml
. Packaging has no problem, however, when starting the web-app, it causes the "NoClassDefFound" error:
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
Here's my pom.xml config:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<开发者_运维知识库;version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
Also, I included following config in applicationContext.xml:
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
I wonder what I am doing wrong here?
Look in the deployed web-app to see if the JAR file is present. (It should be in the webapp's WEB-INF/lib directory.) If it is missing, check the WAR file contents, and then the maven sandbox you used to create it.
(If you really did manage to package the WAR properly, you've probably run into a deployment glitch.)
精彩评论