Forum Discussion

Radford's avatar
Radford
Super Contributor
8 years ago

TestRunner GroovyCastException Exception With 3rd Party Libraries In The bin\ext Directory

I am having a problem where a Groovy script, which is part of a TestCase is successfully running via the GUI but throws a GroovyCastException exception when run via the TestRunner batch file (both launched from the GUI or run via Jenkins). The exception message is:

 

Cannot cast object '<XXXXX>' with class '<XXXXX>' to class '<XXXXX>'

 

With the class <XXXXX> coming from a jar file in the bin\ext directory.

 

After a bit of Googling I discovered that this was most likely due to the same class being loaded twice by two different class loaders, thus treated as different classes, which lead me to the following post:

 

https://community.smartbear.com/t5/SoapUI-NG/class-cast-exception-mystery-in-SoapUI-Pro-4-5-0/m-p/27885/highlight/true#M13578

 

Where the solution was to move the library jars in question from the bin\ext directory to the ReadyAPI\lib directory. While this works around my problem, it doesn't feel quite right as I'm mixing my jar file with ReadyAPIs and the documentation clearly states to place 3rd party libraries in bin\ext. Also it only fails when run with TestRunner.

 

Is there a solution to get this working with the jars in bin\ext or is it appropriate to add files to soapui\lib?

No RepliesBe the first to reply