penazik
penazik

Reputation: 31

No signature of method: static com.mongodb.MongoCredential.createCredential()

MongoCredential.createCredential() is throwing error response for arguments that seem valid according to the documentation (Groovy with gmongo).

The code I'm trying to execute:

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

import java.util.*;
import com.gmongo.GMongo
import com.gmongo.GMongoClient
import com.mongodb.MongoCredential
import com.mongodb.MongoClientOptions
import com.mongodb.client.MongoDatabase; 
import com.mongodb.*
import com.mongodb.ServerAddress
import com.gmongo.*
import com.mongodb.MongoURI
import com.mongodb.DBCursor;
import com.mongodb.BasicDBObject;
import com.mongodb.BasicDBList

def mongoendpoint = context.expand( '${#Project#mongoendpoint}' )
def mongocollection=context.expand( '${#Project#mongocollection_ignition}' )
char[] password = 'password'.toCharArray();

 def credentials = MongoCredential.createCredential(
           context.expand('${#Project#MongoUser}'),
           context.expand('${#Project#MongoDatabase}'),
           password
           // "password" as char[] doesn't work either
           )

Getting the following error:

groovy.lang.MissingMethodException: No signature of method: static com.mongodb.MongoCredential.createCredential() is applicable for argument types: (java.lang.String, java.lang.String, [C) values: [elenalenenko, test, p7Aqmlt9FF!] Possible solutions: createPlainCredential(java.lang.String, java.lang.String, [C) error at line: 34

Documentation says syntax is

static MongoCredential  createCredential(String userName, String database, char[] password)

Upvotes: 0

Views: 858

Answers (1)

penazik
penazik

Reputation: 31

Seems like it's a problem with ReadyAPI 2.2.0 Rolled back to ReadyAPI 2.1.0 and everything works perfectly. Raised a support ticket with SmartBear

Upvotes: 0

Related Questions