Contributions
Re: Handling POIXML Exception in Groovy Scripting
Hi JHunt, Sorry for delayed reply. Tried it using your script too but it does not work. XLSX file is just two row data. Could you please try to read data in groovy script as test step in soapUI from attached sheet. SOAP UI - 5.5.0 Added error log from error output: Not sure if it has something to have with jars placed inside ext and lib folder. Can you share your jars for soap in ext and lib. Thanks Thu Aug 08 11:05:09 IST 2019:ERROR:org.apache.poi.ooxml.POIXMLException: org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions; org.apache.poi.ooxml.POIXMLException: org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:66) at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:657) at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:180) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:282) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:88) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.poi.ss.usermodel.WorkbookFactory.createWorkbook(WorkbookFactory.java:339) at org.apache.poi.ss.usermodel.WorkbookFactory.createXSSFWorkbook(WorkbookFactory.java:314) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:232) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:198) at org.apache.poi.ss.usermodel.WorkbookFactory$create.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) at Script1.run(Script1.groovy:17) 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.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63) ... 24 more Caused by: java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.ooxml.POIXMLTypeLoader.(POIXMLTypeLoader.java:43) at org.apache.poi.xssf.model.ThemesTable.(ThemesTable.java:86) ... 30 more944Views0likes1CommentRe: Handling POIXML Exception in Groovy Scripting
It did not work by placing jar file in ext folder. We have added jars files in soap/bin/ext folder for us. We are using SOAP 5.5.0. Thanks activation-1.1.1 commons-codec-1.12 commons-collections4-4.3 commons-compress-1.18 commons-logging-1.2 commons-math3-3.6.1 curvesapi-1.06 jaxb-api-2.3.0 jaxb-core-2.3.0.1 jaxb-impl-2.3.0.1 junit-4.12 log4j-1.2.17 ooxml-schemas-1.4 poi-4.1.0 poi-examples-4.1.0 poi-excelant-4.1.0 poi-ooxml-4.1.0 poi-scratchpad-4.1.0 xmlbeans-3.1.02.1KViews0likes5Comments- 2.1KViews0likes9Comments
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)2.5KViews0likes11Comments