I am trying a simple example of file upload in spring MVC using maven and I follwed this tutorial.
But I am getting this error
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
I also included the dependencies in 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
<!-- 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
add this to your POM
<dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> <!-- makesure correct version here --> </dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With