Forum Discussion

mk107's avatar
mk107
Occasional Contributor
6 years ago

Handling POIXML Exception in Groovy Scripting

We are trying to read data from xlsx file using apache POI, we have all the jars files placed under soap/bin/ext. It gives us below error when running our groovy script.


org.apache.poi.ooxml.POIXMLException: org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions; error at line: 15

 

Code:

 

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.usermodel.CellStyle;

FileInputStream inputStream = new FileInputStream("D:\\SOAP\\ExcelPOI.xlsx")

Workbook wb = WorkbookFactory.create(inputStream)
Sheet sheet1 = wb.getSheet("Sheet Name")
int rows = sheet1.getLastRowNum();
log.info(rows)

    • mk107's avatar
      mk107
      Occasional Contributor
      Poi version is 4.1.0
      • avidCoder's avatar
        avidCoder
        Super Contributor

        Add this jar file also in bin/ext folder - ooxml-schemas-1.4.jar and then restart your soap ui. If you have already added some version of ooxml-schemas_version_name.jar.. Then remove that. for poi version 4.1.0 you have to use ooxml-schemas-1.4.jar.