Ask a Question

Groovy script not working in SoapUI but works in ReadyAPI

SOLVED
harmancheema
Occasional Contributor

Groovy script not working in SoapUI but works in ReadyAPI

Hi,

 

I have a project which works in ReadyAPI v2.4.0. I want to run the project in SoapUI-5.4.0, but the groovy script to connect to Mongo fails at the first. The DB setup is the same. I'm not sure why it's failing. Any help is appreciated!!

 

Here's the beginning of the script:

 

import com.gmongo.GMongo
def mongo = new GMongo('127.0.0.1:27017');
def db = mongo.getDB('collection');

 Here's the error message I get:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script9.groovy: 1: 
unable to resolve class com.gmongo.GMongo @ line 1, column 1. import com.gmongo.GMongo
^ org.codehaus.groovy.syntax.SyntaxException:
unable to resolve class com.gmongo.GMongo @ line 1, column 1.
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:149)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1225)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:178)
at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:694)
at groovy.lang.GroovyShell.parse(GroovyShell.java:706)
at groovy.lang.GroovyShell.parse(GroovyShell.java:742)
at groovy.lang.GroovyShell.parse(GroovyShell.java:733)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:136)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:87)
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(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748) 1 error
3 REPLIES 3
Radford
Super Contributor

My guess is that your copy of Ready API has the required mongo Java library files already installed, but your copy of SoapUI doesn't.

 

Third party library files should be put in the bin/ext directory, see the following page for deatils:

 

https://support.smartbear.com/readyapi/docs/testing/scripts/about.html

harmancheema
Occasional Contributor

Hello,

 

Yes, that was exactly the problem. I figured it out as well. Once I copied the mongo jar files in the /bin/ext folder for SoapUI, my project worked. Thanks for your help!!! 🙂

 

 

Can you help me with the jar file used for this. I have placed beow jar in bin/ext folder but still getting error

 

> mongodb-driver-3.4.2

mongo-java-driver-3.4.2

 

cancel
Showing results for 
Search instead for 
Did you mean: