The mentioned package/classes are not present in the compiletime classpath. Basically, Java has no idea what you’re talking about when you say to import this and that. It can’t find them in the classpath.
It’s part of Apache Commons FileUpload. Just download the JAR and drop it in /WEB-INF/lib
folder of the webapp project and this error should disappear. Don’t forget to do the same for Apache Commons IO, that’s where FileUpload depends on, otherwise you will get the same problem during runtime.
Unrelated to the concrete problem, I see that you’re using Tomcat 7, which is a Servlet 3.0 compatible container. Do you know that you can just use the new request.getPart()
method to obtain the uploaded file without the need for the whole Commons FileUpload stuff? Just add @MultipartConfig
annotation to the servlet class so that you can use it. See also How to upload files to server using JSP/Servlet?
Related Posts:
- HTTP Status 405 – HTTP method is not supported by this URL
- java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
- What is WEB-INF used for in a Java EE web application?
- java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has been committed
- The import javax.servlet can’t be resolved
- How to uninstall Eclipse?
- Eclipse/Maven error: “No compiler is provided in this environment”
- Can’t start Eclipse – Java was started but returned exit code=13
- Can’t start Eclipse – Java was started but returned exit code=13
- Eclipse IDE for Java – Full Dark Theme
- Is there a way to convert all comments into javadoc comments? [Eclipse/Java]
- How to solve could not create the virtual machine error of Java Virtual Machine Launcher?
- How to solve could not create the virtual machine error of Java Virtual Machine Launcher?
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Editor does not contain a main type
- A JNI error has occurred, please check your installation and try again in Eclipse x86 Windows 8.1
- Failed to write core dump. minidumps are not enabled by default on client version of windows
- How to uninstall Eclipse?
- Editor does not contain a main type in Eclipse [duplicate]
- getting error HTTP Status 405 – HTTP method GET is not supported by this URL but not used `get` ever?
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Editor does not contain a main type in Eclipse [duplicate]
- What is Java Servlet?
- undefined reference to `WinMain@16′
- JRE Missing when installing eclipse
- The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
- The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
- How to request.getParameterNames into List of strings?
- A JNI error has occurred, please check your installation and try again in Eclipse x86 Windows 8.1
- make: g++: Command not found
- “g++” is not recognized as an internal or external command, MinGW
- Server Tomcat v9.0 Server at localhost failed to start
- Eclipse: Enable autocomplete / content assist
- java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
- Eclipse C++ : “Program “g++” not found in PATH”
- “insufficient memory for the Java Runtime Environment ” message in eclipse
- Control an Arduino with Java
- Cannot find “Package Explorer” view in Eclipse
- Why Maven project is tied to J2SE-1.5 by default?
- JVM Crash – “EXCEPTION_ACCESS_VIOLATION”
- Session TimeOut in web.xml
- what does Dead Code mean under Eclipse IDE Problems Section
- what does Dead Code mean under Eclipse IDE Problems Section
- How do I resolve the “java.net.BindException: Address already in use: JVM_Bind” error?
- Eclipse: Java was started but returned error code=13
- “g++” is not recognized as an internal or external command, MinGW
- Server Tomcat v9.0 Server at localhost failed to start
- Opening JSF Facelets page shows “This XML file does not appear to have any style information associated with it.”
- web.xml is missing and
is set to true - Facebook login NullPointerException
- The program can’t start because cygwin1.dll is missing… in Eclipse CDT
- Eclipse C++ : “Program “g++” not found in PATH”
- Unbound classpath container in Eclipse
- How to change a package name in Eclipse?
- what is this ANT build?
- ‘cannot open git-upload-pack’ error in Eclipse when cloning or pushing git repository
- Eclipse “Error: Could not find or load main class”
- Error: Selection does not contain a main type
- How to solve javax.net.ssl.SSLHandshakeException Error?
- “Server Tomcat v7.0 Server at localhost failed to start” without stack trace while it works in terminal
- java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
- Uri not Absolute exception getting while calling Restful Webservice
- Integrate Ant builder into Eclipse: Error “Variable references empty selection”
- Cannot change version of project facet Dynamic Web Module to 3.0?
- “Server Tomcat v7.0 Server at localhost failed to start” without stack trace while it works in terminal
- web.xml is missing and
is set to true – web.xml is there and can’t edit deployment assembly - “Could not find Java SE Runtime Environment.” after installing Java
- Server Tomcat v8.0 Server at localhost failed to start. after declaring servlet name and mapping in web.xml file
- eclipse won’t start – no java virtual machine was found
- Eclipse does not start when I run the exe?
- The declared package does not match the expected package “”
- How to solve “Plugin execution not covered by lifecycle configuration” for Spring Data Maven Builds
- eclipse won’t start – no java virtual machine was found
- Eclipse Java error: This selection cannot be launched and there are no recent launches
- How can I avoid this Ant Build error?
- Eclipse returns error message “Java was started but returned exit code = 1”
- java.lang.NumberFormatException: null i
- ORA-12518, TNS:listener could not hand off client connection
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- how to run the command mvn eclipse:eclipse
- bootstrap navbar not working correctly
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- Eclipse error, “The selection cannot be launched, and there are no recent launches”
- How do I set up Eclipse/EGit with GitHub?
- Failed to load the JNI shared Library (JDK)
- channel 3: open failed: connect failed: Connection refused
- Eclipse error: indirectly referenced from required .class files?
- Java can’t find file when running through Eclipse
- Ant “JAVA_HOME does not point to the JDK” – but it does
- Program “make” not found in PATH
- Eclipse java debugging: source not found
- WebServlet cannot be resolved to a type
- No appenders could be found for logger(log4j)?
- How to resolve the “ADB server didn’t ACK” error?
- Syntax error on token(s), misplaced construct(s)
- Error occurred during initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)
- HTTP Status 500 Error instantiating servlet class
- Eclipse internal error while initializing Java tooling
- “The public type <
> must be defined in its own file” error in Eclipse [duplicate]