title: NoSuchMethodError (initialization failure) while reading excel xlsx file using apache poi
body: <p>I've tried to apply <code>apache poi</code> but failed. I have been searching around to find the solution, yet still cannot solve the problem. Not sure whether is java version not compatible or missing jar file. I need a guidance from a professional.</p>
  
  <p>Current version after system.out : <B> 1.6.0 </b>
  <code>System.out.println(Runtime.class.getPackage().getImplementationVersion());</code></p>
  
  <p>External Jar file added:<br/>
  - dom4j-1.6.1.jar<br/>
  - log4j-1.2.17.jar<br/>
  - junit-4.11.jar<br/>
  - poi-3.11-20141211.jar<br/>
  - poi-ooxml-3.11-20141211.jar<br/>
  - poi-ooxml-schemas-3.11-20141211.jar<br/>
  - xmlbeans-2.6.0.jar</p>
  
  <h3>JSP FILE</h3>
  
  <pre><code>//jsp is my front end system
  
  &lt;jsp:useBean id="ReadXLSXFile" scope="page" class="com.home.file.ReadXLSXFile" /&gt;
  &lt;script&gt;
      if(sType.equals("Y"))
      {
        ReadXLSXFile.main(null);
      }
  &lt;/script&gt;
  </code></pre>
  
  <h3>Java file</h3>
  
  <pre><code>package com.home.file;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Iterator;
  import org.apache.poi.ss.usermodel.Cell;
  import org.apache.poi.ss.usermodel.Row;
  import org.apache.poi.xssf.usermodel.XSSFSheet;
  import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  
  public class ReadXLSXFile {
  
  public static void main(String[] args) {
  
      try {
          File excel = new File("C:/Banklist.xlsx");
          FileInputStream fis = new FileInputStream(excel);
          XSSFWorkbook book = new XSSFWorkbook(fis);
          XSSFSheet sheet = book.getSheetAt(0);
  
          Iterator&lt;Row&gt; itr = sheet.iterator();
  
          // Iterating over Excel file in Java
          while (itr.hasNext()) {
              Row row = itr.next();
  
              // Iterating over each column of Excel file
              Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
              while (cellIterator.hasNext()) {
  
                  Cell cell = cellIterator.next();
  
                  switch (cell.getCellType()) {
                  case Cell.CELL_TYPE_STRING:
                      System.err.print(cell.getStringCellValue() + "\t");
                      break;
                  case Cell.CELL_TYPE_NUMERIC:
                      System.err.print(cell.getNumericCellValue() + "\t");
                      break;
                  case Cell.CELL_TYPE_BOOLEAN:
                      System.err.print(cell.getBooleanCellValue() + "\t");
                      break;
                  default:
  
                  }
              }
              System.err.println("");
          }
  
      } catch (FileNotFoundException fe) {
          fe.printStackTrace();
      } catch (IOException ie) {
          ie.printStackTrace();
      }
  }
  }
  </code></pre>
  
  <p>error is shown after read the excel file.xlsx
  <img src="https://i.stack.imgur.com/NpNKp.png" alt="enter image description here"></p>
  
  <p>Eclipse console result : </p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller (initialization failure)
  at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
  at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
  at org.apache.poi.openxml4j.opc.OPCPackage.&lt;init&gt;(OPCPackage.java:141)
  at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:87)
  at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
  at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
  at org.apache.poi.xssf.usermodel.XSSFWorkbook.&lt;init&gt;(XSSFWorkbook.java:258)
  at com.rexit.easc.ReadXLSXFile.main(ReadXLSXFile.java:26)
  at com.ibm._jsp._pop_5F_cnFW_5F_nstbl._jspService(_pop_5F_cnFW_5F_nstbl.java:500)
  </code></pre>
  
  <p>P/s : the question is quite similar with this thread, but I still cannot figure it out. <a href="https://stackoverflow.com/questions/26866398/nosuchmethoderror-in-main-thread-while-reading-xlsx-using-apache-poi/27754033#27754033">Here</a></p>