Ask a Question

java.lang.NoClassDefFoundError with Apache POI

lcordy
Occasional Contributor

java.lang.NoClassDefFoundError with Apache POI

I was not getting this error in SoapUI 5.3 free version, exactly the same code reading Excel in ReadyAPI throws the error below. I copied the same jar files from bin/ext folder from SoapUI 5.3 to ReadyAPI. I have tried the suggestion at https://poi.apache.org/faq.html#faq-N10025 and placed ooxml-schemas-1.3.jar in my bin/ext folder as well, to no avail.

 

Wed Jan 24 15:24:33 NZDT 2018:ERROR:java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getSAMMethod(CachedSAMClass.java:164)
at org.codehaus.groovy.reflection.ClassInfo.isSAM(ClassInfo.java:359)
at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:349)
at org.codehaus.groovy.reflection.ClassInfo.access$700(ClassInfo.java:41)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:497)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:488)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:49)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:36)
at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:111)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:110)
at org.codehaus.groovy.reflection.ParameterTypes.getParametersTypes0(ParameterTypes.java:81)
at org.codehaus.groovy.reflection.ParameterTypes.getParameterTypes(ParameterTypes.java:67)
at org.codehaus.groovy.reflection.CachedMethod.compareToMethod(CachedMethod.java:186)
at org.codehaus.groovy.reflection.CachedMethod.compareTo(CachedMethod.java:142)
at org.codehaus.groovy.reflection.CachedMethod$MyComparator.compare(CachedMethod.java:315)
at java.util.Arrays.binarySearch0(Unknown Source)
at java.util.Arrays.binarySearch(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.find(CachedMethod.java:68)
at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:2522)
at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:2261)
at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3302)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3266)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:254)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:295)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:261)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:871)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createPojoSite(CallSiteArray.java:125)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:166)
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:117)
at Script3.run(Script3.groovy:38)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:98)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:82)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:156)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:316)
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.ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 44 more

18 REPLIES 18
nmrao
Community Hero

Have you restarted the tool after copying the jar files?


Regards,
Rao.
lcordy
Occasional Contributor

Yep, restarted. Using Poi 3.17 by the way.
nmrao
Community Hero

Thanks for clarifying. Would you please list all the files under /bin/ext directory?


Regards,
Rao.
lcordy
Occasional Contributor

Files in bin/ext attached.

This worked for me, incase you still have the issue.

I downloaded the ooxml-schemas-1.3.jar file and placed it into bin/ext along with all the other poi jars.

def fs = new FileInputStream("D:/sample.xlsx")
def wb = new XSSFWorkbook(fs)
def ws = wb.getSheet("Sheet1")

Executing ...Groovy script

Which dependency is missing? - got this error SOAP UI 5.4 An error occurred [org/apache/commons/compress/archivers/zip/ZipFile], see error log for details

 

Can any one help please!

Jason1
New Contributor

I downloaded the ooxml-schemas-1.3.jar file and placed it into bin/ext along with all the other poi jars.

But I still have the same problem : CTExtensionList error

JoanLi
New Contributor

I meet the same problem. When I use  " def wb= new XSSFWorkbook(file)", the error prompt which is the same as above pops up. When I use " def wb= WorkbookFactory.reate(file);", there is no response. I mean there is no error popping up or log printing. In fact, the same script runs properly in my groovy IDE. I am not sure if the soapui 5.4 can not use the poi 4.0.

My aim is to read and write and xlsx file from Groovy Test Step.

For xls files everything worked fine.

Trying upgrading to poi vers. > 3.12 is not that helpful because on ReadyAPI or SOAPUI Pro version this will break Test Step Datasource with Excel for loading data. The Test Step is then failed.

I then rolback and have to face the multiple issues described here. I was unsuccessful everytime.

 

After trying all available API in POI and also trying using the additional OOXML Schemas lib I must admitted too: Handling / updating xlsx files in Groovy step is not currently possible.

 

ERROR: An error occurred [org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList], see error log for details

cancel
Showing results for 
Search instead for 
Did you mean: