[英]Spring and MongoDB Async Java Driver - clusterListener can not be null
我正在嘗試使用MongoDB的異步Java驅動程序連接到MongoDB。
MongoClient mongoClient = MongoClients.create();
但是,它引發以下錯誤:
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)
有人遇到過這個問題並有解決方案嗎?
只需更新到mongo驅動程序版本(最新),然后使用最新的依賴項重建項目。
我已經通過重建解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.