Ask a Question

SCRAM-SHA-1 mongodb authentication using SOAP UI grrovy

Occasional Contributor

SCRAM-SHA-1 mongodb authentication using SOAP UI grrovy

I am trying to write a script for connecting mongodb on the server using groovy, MongoDB uses 'SCRAM-SHA-1' auth mechanism, application is in SSL mode. I have imported key strokes in VM options file, SSL settings in preference. Code is executable in eclipse successfully but failing in ReadyAPI.


getting following error

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=xx.xx.xx.xx, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by { No subject alternative names present}, caused by { No subject alternative names present}}] error at line: 28.


Any suggestions.

SmartBear Alumni (Retired)

Hi Saradhipb,



What Ready! API version are you using? Please check if you get the same error in the latest version - v. 1.8.5. You can download the installation file here:

Tanya Yatskovskaya
SmartBear Community and Education Manager

Occasional Contributor

Hi Tanya,


I was using Ready API version 1.7. Downloaded the updated version 1.8.5, I have been facing the same issue. As indicated earlier i am able to run a similar Java code in eclipse successfully.


@Grab(group='com.gmongo', module='gmongo', version='1.3')

import com.mongodb.BasicDBObject
import com.mongodb.DB
import com.mongodb.DBCollection
import com.mongodb.DBCursor
import com.mongodb.MongoClient
import com.mongodb.MongoClientURI

MongoClientURI uri = new MongoClientURI("mongodb://xxxxx:xxxx123@xx.xx.xx.x:27017/xxxxxdb?ssl=true&mechanism='SCRAM-SHA-1'");
MongoClient mongoClient = new MongoClient(uri)
DB db = mongoClient.getDB("xxxxxdb")
DBCollection collec = db.getCollection("yyyyyy")
BasicDBObject query = new BasicDBObject()
DBCursor cursor = collec.find(query)
while (cursor.hasNext()) {
BasicDBObject test= (BasicDBObject)( test

Occasional Contributor

Finally I got a solution by using MongoClientOptions


Showing results for 
Search instead for 
Did you mean: