0 votes
1 view
in Web Technology by (11.2k points)

MongoClientURI uri = new MongoClientURI(

"mongodb+srv://<username>:<password>cluster0-kjxf3.mongodb.net/test?retryWrites=true&w=majority");

MongoClient mongoClient = new MongoClient(uri);

Returns Response message:Exception: java.lang.IllegalArgumentException: uri needs to start with mongodb://. Above URL example comes from MongoDB Atlas manual, deleting +srv causes:

java.net.UnknownHostException: mongodb.net: Name or service not known

1 Answer

0 votes
by (22.1k points)

To connect to an Atlas M0 (Free Tier) cluster, you must use Java version 8 or greater and use a Java driver version that supports MongoDB 3.4.

So make sure to download MongoDB Java Driver version 3.4 or higher and drop it to JMeter Classpath. You will also need to remove all previous versions of the MongoDB Driver to avoid Jar Hell. JMeter restart will be required to pick up the new .jar and unload old ones (if any)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...