I have a problem with my web application, I'm trying to upload a file but the console show me some errors. I'm using the Apache Commons Fileupload API.
This is my Servlet CargaArchivo.java
:
File repository = new File(this.getServletContext().getRealPath("repository"));//Create a new DIR to the files
repository.mkdir();//Make it DIR
System.out.println("================Path: " + repository.getAbsolutePath());//Show the PATH of the DIR
factory.setRepository(repository);//Here is the problem
Of course the form(just in case) index.html
:
<form method="post" enctype="multipart/form-data" action="CargaArchivo">
<label for="archivo">Archivo:</label>
<input type="file" id="archivo" name="inputFile">
<button>Cargar</button>
</form>
And this the output console
:
Información: ================Path: C:\Users\lopez-e\Documents\NetBeansProjects\Tutorial_CargaArchivo\build\web\repository
Advertencia: StandardWrapperValve[CargaArchivo]: Servlet.service() for servlet CargaArchivo threw exception
java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils
I do not know what's wrong.