Usage of Apache POI 4.1.0 with xmlbeans-3.1.0

Katalon Studio / Runtime Engine version : 7.7.2

Scenario/Background :

Currently I am using poi-4.1.0 for output some test evidence to Excel file.
In order to use poi-4.1.0, instead of importing via Gradle or external library in project’s setting, I cloned the jar file to \Katalon_Studio_7.7.2\configuration\resources\lib and remove the following dependencies that are related to poi-3.17 as I am intended to use the newer version :

  • poi-3.17.jar
  • poi-ooxml-3.17.jar
  • poi-ooxml-schemas-3.17.jar
  • xmlbeans-2.6.0.jar. ( For poi-4.1.0, it needs xmlbeans-3.1.0.jar instead. )

I have to delete the above jars, otherwise when I use any class from poi such like XSSFWorkbook, it will keep referring the class from poi-3.17.

Issue :

I can use poi-4.1.0 without any issue in Katalon Studio after importing the dependencies like above.
However, when I tried to run my test suite with Katalon Runtime Engine, it ran into the following error :

java.lang.NNoSuchMethodError : org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit

I did some investigation and realize that it is because such method is not existed in org.apache.xmlbeans-2.6.0 which comes along with Katalon Studio and Katalon Runtime Engine ( in the \Katalon_Studio_7.7.2\plugins folder. )

Seems that in Katalon Runtime Engine’s case, the org.apache.xmlbeans-2.6.0 will be loaded before the xmlbeans-3.1.0 that I imported manually. ( Katalon Studio has different class paths loading precedence than Runtime Engine. )

I once tried replacing the xmlbeans in Katalon Runtime Engine with the newer version, but that breaks the engine itself.

Tagging @devalex88 @ThanhTo
Is there any way that we can manage the dependency precedence if we want to use some depedencies that are also used by Katalon Runtime Engine ? or perhaps a workaround ?

Hi @stjobiwtc

Currently we’re working on the feature to allow you to exclude certain libraries from KSE/KRE and include your own. I will keep you updated when it’s out.

@Brandon_Hein

Thank you for bringing this thread up again.
Recently I came back to this issue and see if the new library management feature can solve it.
Unfortunately seems the issue still persists.
Seems the library excluding feature only replaces the dependencies from
/Katalon_Studio_X.X.X/configuration/resources/lib/.
In this case the xmlbeans_2.6.0.jar exists under these paths /Katalon_Studio_X.X.X/plugins/org.apache.xmlbeans-2.6.0.jar.
/Katalon_Studio_X.X.X/configuration/resources/lib/xmlbeans-2.6.0.jar"

In KRE, seems the dependencies under /plugins will be loaded before /resources/lib, which causes the xmlbeans-3.1.0.jar not being referred.

Hello,
Have you please a news about this feature ?
Thank you

Hi there, in KS we already implemented the feature that allows you to exclude built-in libraries so that there’s no conflict with the libraries that you manually add

1 Like

can I use newer version of poi? when I disable poi-3.17.jar it causes error with katalon existing feature.