title: Upload Excel file to servlet and get data from it
body: <p>I'm trying to upload excel file to a servlet, get data from it and then send this data to a database.</p>
  
  <p>And I'm stuck at the very beginning: uploading the file.</p>
  
  <p>To get data from the file, I want to use Apache POI, and here is my code:</p>
  
  <pre><code>System.out.println("entered Import.java");
  Part filePart = request.getPart("import"); 
  System.out.println("filePart: "+filePart);
  
  FileInputStream inputStream = (FileInputStream) filePart.getInputStream();
  System.out.println("inputStream: "+inputStream);
  
  Workbook book = WorkbookFactory.create(inputStream);
  
  Sheet sheet = book.getSheetAt(0);
  
  for (Row row : sheet) {
      for (Cell cell : row) {
          System.out.println("row: "+row+", cell value: "+cell.getRichStringCellValue().getString());
      }
  }
  inputStream.close();
  </code></pre>
  
  <p>The output of this code is:</p>
  
  <pre><code>entered Import.java
  filePart: org.apache.catalina.core.ApplicationPart@bc6f13
  inputStream: java.io.FileInputStream@532048c5
  Servlet.service() for servlet [Import] in context with path [/Management] threw exception [Servlet execution threw an exception] with root causejava.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions
  </code></pre>
  
  <p>The UI part is SAPUI5 framework and <a href="http://jsbin.com/falopilada/1/edit?js" rel="nofollow noreferrer">here it is</a>.</p>
  
  <p>I looked through <a href="https://stackoverflow.com/questions/22985809/upload-read-an-excel-file-in-a-jsp-using-poi">this</a> and <a href="https://stackoverflow.com/questions/2422468/how-to-upload-files-to-server-using-jsp-servlet">this</a> threads, but it didn't help me.</p>
  
  <p>How do I get this servlet to work? </p>