Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (19.9k 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 (25.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)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...