mongodb报错:timeout报错

小灰灰 2022-05-26 05:24 599阅读 0赞
  1. MongoCredential credential = MongoCredential.createCredential(username, dbname , password.toCharArray());

原来为

  1. MongoCredential credential = MongoCredential.createMongoCRCredential(username, dbname , password.toCharArray());

错误消息

  1. com.mongodb.MongoSecurityException: Exception authenticating
  2. at com.mongodb.connection.NativeAuthenticator.authenticate(NativeAuthenticator.java:48) ~[mongodb-driver-core-3.4.3.jar:na]
  3. at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:109) ~[mongodb-driver-core-3.4.3.jar:na]
  4. at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:46) ~[mongodb-driver-core-3.4.3.jar:na]
  5. at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:116) ~[mongodb-driver-core-3.4.3.jar:na]
  6. at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.3.jar:na]
  7. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
  8. Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'auth failed' on server 10.120.112.96:27017. The full response is { "ok" : 0.0, "errmsg" : "auth failed", "code" : 18, "codeName" : "AuthenticationFailed" }
  9. at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170) ~[mongodb-driver-core-3.4.3.jar:na]
  10. at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123) ~[mongodb-driver-core-3.4.3.jar:na]
  11. at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32) ~[mongodb-driver-core-3.4.3.jar:na]
  12. at com.mongodb.connection.NativeAuthenticator.authenticate(NativeAuthenticator.java:46) ~[mongodb-driver-core-3.4.3.jar:na]
  13. ... 5 common frames omitted

发表评论

表情:
评论列表 (有 0 条评论,599人围观)

还没有评论,来说两句吧...

相关阅读