Forum Discussion

rstromlund's avatar
7 years ago

How to import from bin/ext instead of lib?

I am running SOAP-UI 5.4.0 and I am trying to write a groovy script that uses org.openqa.selenium.htmlunit.HtmlUnitDriver and com.gargoylesoftware.htmlunit.BrowserVersion.  So I drop the appropriate jars into bin/ext.  These libraries depend on htmlunit-2.18 but there is already htmlunit-2.7 in lib so I get errors like this:

  • java.lang.NoSuchMethodError: com.gargoylesoftware.htmlunit.WebClient.getOptions()Lcom/gargoylesoftware/htmlunit/WebClientOptions; error at line: 66

Files:

  • .../bin/ext/htmlunit-2.18.jar
  • .../bin/ext/htmlunit-core-js-2.17.jar
  • .../lib/htmlunit-2.7.jar
  • .../lib/htmlunit-core-js-2.7.jar

I instantiated a BrowserVersion and ran

  • log.info "class jar = ${ff.class.name}; ${ff.class.getResource('/com/gargoylesoftware/htmlunit/BrowserVersion.class')}"
  • > class jar = com.gargoylesoftware.htmlunit.BrowserVersion; jar:file:/C:/.../lib/htmlunit-2.7.jar!/com/gargoylesoftware/htmlunit/BrowserVersion.class

So you can see it picks the lib 2.7 jar instead of my bin/ext 2.18 jar.

 

Is there a way to make the loader choose the SoapUIExtensionClassLoader (bin/ext) first?

 

I've thought about modifying the lib version but I don't know that htmlunit is strictly backwards compatible and I don't want to mess SOAP-UI up.  I also might want to pass this script on to others and don't want to suggest modifying their app directories either.

 

Thought?

Thx.

No RepliesBe the first to reply