9/30/15

solution : package org.apache.tomcat.util.http.fileupload.servlet does not exist

Hi readers,

This issue comes when you are building your project either with Maven or other case. It is not present so you are getting package org.apache.tomcat.util.http.fileupload.servlet does not exist error. You are using fileupload.servlet in your file upload (may be multi-part file upload) functionality. 
In your web project, inside eclipse IDE required class is coming from tomcat's jar. while it can also come from org.apache.commons.fileupload.servlet.ServletFileUpload. 
Specially if you are building using Maven then package org.apache.tomcat.util.http.fileupload.servlet will not be there as it is coming from tomcat.
So there are two solutions to it.

Solution 1:-

You copy required jars from tomcat and put jars to /WEB-INF/lib location.

Solution 2:-

You need to download commons-fileupload.jar and commons-io.jar files and put them to /WEB-INF/lib location. Alternately if you are using maven then you can give dependencies in your pom.xml file

                 <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>