0

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.

Chomboreco
  • 77
  • 8
  • 2
    Deploy `org.apache.commons.io.jar` with your web app – Reimeus Jun 02 '15 at 16:28
  • 2
    You lack libraries to do the job. Add Apache Commons IO to your WEB-INF/lib or as dependency in your dependency manager tool (maven, gradle or whatever you use), recompile and redeploy the project. – Luiggi Mendoza Jun 02 '15 at 16:28
  • I thought the Apache API that library already had implemented.Thanks friend – Chomboreco Jun 02 '15 at 16:31

0 Answers0