amkay
amkay

Reputation: 13

Spring and MongoDB Async Java Driver - clusterListener can not be null

I am trying to connect to MongoDB using MongoDB's async Java driver.

MongoClient mongoClient = MongoClients.create();

However, it is throwing following error:

java.lang.IllegalArgumentException: clusterListener can not be null
    at com.mongodb.assertions.Assertions.notNull(Assertions.java:37)
    at com.mongodb.connection.ClusterSettings$Builder.addClusterListener(ClusterSettings.java:218)
    at com.mongodb.connection.DefaultClusterFactory.getClusterSettings(DefaultClusterFactory.java:190)
    at com.mongodb.connection.DefaultClusterFactory.create(DefaultClusterFactory.java:46)
    at com.mongodb.async.client.MongoClients.createCluster(MongoClients.java:96)
    at com.mongodb.async.client.MongoClients.create(MongoClients.java:55)
    at com.mongodb.async.client.MongoClients.create(MongoClients.java:75)
    at com.mongodb.async.client.MongoClients.create(MongoClients.java:45)
    at com.monbodb.async.mongoasync.MongoasyncApplication.main(MongoasyncApplication.java:22)

Has anyone encountered this before and has a solution?

Upvotes: 0

Views: 1338

Answers (1)

Anand Tiwari
Anand Tiwari

Reputation: 77

Just update to mongo driver version (Latest) and rebuild the project with latest dependencies.

I have solved this issue with a rebuild.

Upvotes: 2

Related Questions