I am trying to call a method from java to connect to the mongoDB database, my machine can do it successfully but if I run it with a different one, I get this error.
2020-07-15 12:57:21,751 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import test.MongoDB; MongoDB.connect(vars.get("uri"));'' : Method Invocation MongoDB.connect
What could be the problem?
java
import java.util.LinkedHashMap;
import java.util.Map;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
public class MongoDB {
public static MongoDatabase database;
public static MongoClient mongoClients;
public static void connect(String uri) {
MongoClientURI uri_1 = new MongoClientURI(uri);
// Connecting With Server
mongoClients = new MongoClient(uri_1);
System.out.println("server connection successfully done");
database = mongoClients.getDatabase("Capacitacion");
System.out.println("Connect to database successfully");
System.out.println("DataBase Name: " + database.getName());
MongoCollection<Document> col_Capacitacion_Liceo = database.getCollection("Liceo");
} ```
jmeter
```import test.MongoDB;
MongoDB.connect(vars.get("uri"));;```
*