harmancheema
7 years agoOccasional Contributor
MongoDB connection working in ReadyAPI but not in SoapUI free version
Hi All,
I have a project being used in both ReadyAPI and SoapUI 5.4.0, and I'm using MongoDB. However, the mongoDB connection is working in ReadyAPI but not in SoapUI. I have copied the jar files in the bin/ext folder already.
This is how I'm connecting to Mongo:
import com.gmongo.GMongo def mongo = new GMongo('127.0.0.1:27017'); def db = mongo.getDB('test');
I get the following when I try to connect to the DB:
ERROR:java.lang.NoClassDefFoundError: com/mongodb/ServerAddress java.lang.NoClassDefFoundError: com/mongodb/ServerAddress at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getDeclaredConstructors(Unknown Source) at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:74) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:71) at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:69) 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.CachedClass.getConstructors(CachedClass.java:268) at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:218) at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:228) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:171) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:161) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:144) at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:253) at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:285) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:257) at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:875) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:87) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247) at Script1.run(Script1.groovy:3) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:90) 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(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.mongodb.ServerAddress at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)
Any help why this is failing?
This happens when you didn't add jars into your Lib folder. ReadyAPI comes with pre-existing libraries.
Try to download mongo jar and add it in your C:\Program Files\SmartBear\SOAPUI-Version\lib folder