bipo1980
8 years agoVisitor
Is there a limitation reading XLSX file using SoapUI free version 5.3.0 & Apache poi-3.14?
Hello:
Is there a limitation reading XLSX file? With XLS file, i face no problems.
My Environment is:
- SoapUI free version 5.3.0
- Apache POI 3.14
- Windows 7 Pro/ Office 2010
Location of Apache POI libraries:
I unzipped the downloaded POI package into the following folder:
C:\Program Files\SmartBear\SoapUI-5.3.0\bin\ext fyi - I have also tried adding it to lib
The error i get when i try to run the groovy script provided later below is:
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
My Groovy Script is:
import java.io.File; import java.io.FileInputStream; import java.util.Iterator; 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; String filepath = "E:\\SoapUiProjects\\MyWorkspace\\data\\data.XLSX" String sheetName = "login" FileInputStream fis = new FileInputStream(new File(filepath)) Workbook wb = WorkbookFactory.create(fis) Sheet sh = wb.getSheet(sheetName) Iterator itrRow = sh.rowIterator() while(itrRow.hasNext()) { Row row = itrRow.next() for(Cell cell : row) { switch(cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: log.info cell.getNumericCellValue() break; default: log.info cell.getRichStringCellValue() } } } fis.close() wb.close()
The Stacktrace:
2017-07-11 15:09:50,631 ERROR [SoapUI] An error occurred [java.lang.reflect.InvocationTargetException], see error log for details 2017-07-11 15:09:50,631 ERROR [errorlog] org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:65) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:601) at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:174) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:249) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:211) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:170) at org.apache.poi.ss.usermodel.WorkbookFactory$create.call(Unknown Source) at Script21.run(Script21.groovy:14) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:90) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56) at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:62) ... 13 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.POIXMLTypeLoader at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:85) ... 19 more
Thank You in advance.
B.