com.mongodb.MongoTimeoutException: Timed out after 5000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primaryPreferred}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=PLAIN, userName='admin', source='yapdns', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 59: 'no such cmd: saslStart' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "no such cmd: saslStart", "code" : 59, "bad cmd" : { "saslStart" : 1, "mechanism" : "PLAIN", "payload" : { "$binary" : "YWRtaW4AYWRtaW4AYWRtaW4xMjM=", "$type" : "0" } } }}}]

Stack Overflow | Nerotix | 7 months ago
  1. 0

    MongoDB elasticsearch mongolastic error

    Stack Overflow | 7 months ago | Nerotix
    com.mongodb.MongoTimeoutException: Timed out after 5000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primaryPreferred}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=PLAIN, userName='admin', source='yapdns', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 59: 'no such cmd: saslStart' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "no such cmd: saslStart", "code" : 59, "bad cmd" : { "saslStart" : 1, "mechanism" : "PLAIN", "payload" : { "$binary" : "YWRtaW4AYWRtaW4AYWRtaW4xMjM=", "$type" : "0" } } }}}]
  2. 0

    Error with getting info from mongo

    GitHub | 7 months ago | nerotix
    com.mongodb.MongoTimeoutException: Timed out after 5000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primaryPreferred}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=PLAIN, userName='admin', source='yapdns', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 59: 'no such cmd: saslStart' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "no such cmd: saslStart", "code" : 59, "bad cmd" : { "saslStart" : 1, "mechanism" : "PLAIN", "payload" : { "$binary" : "YWRtaW4AYWRtaW4AYWRtaW4xMjM=", "$type" : "0" } } }}}]
  3. 0

    Connection to MongoDB with authentication fails

    Stack Overflow | 1 year ago | Yuanping Wu
    com.mongodb.MongoTimeoutException: Timed out after 1000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=10.46.20.65:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'auth failed' on server 10.46.20.65:27017. The full response is { "ok" : 0.0, "errmsg" : "auth failed", "code" : 18 }}}]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    If MongoDB is installed on the same instance as your app, use localhost to connect to MongoDB, e.g. 127.0.0.1:27017.
  6. 0

    MongoDB "Exception authenticating MongoCredential" using java-driver

    Stack Overflow | 5 months ago | Prayag Upd
    play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=secondary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=staging-node3.shaharma.com:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='userId', source='events', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server staging-node3.shaharma.com:27017. The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }}}]]]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.mongodb.MongoTimeoutException

      Timed out after 5000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primaryPreferred}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=PLAIN, userName='admin', source='yapdns', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 59: 'no such cmd: saslStart' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "no such cmd: saslStart", "code" : 59, "bad cmd" : { "saslStart" : 1, "mechanism" : "PLAIN", "payload" : { "$binary" : "YWRtaW4AYWRtaW4AYWRtaW4xMjM=", "$type" : "0" } } }}}]

      at com.mongodb.connection.BaseCluster.createTimeoutException()
    2. MongoDB Java Driver
      MongoCollectionImpl.count
      1. com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:369)
      2. com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:101)
      3. com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
      4. com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
      5. com.mongodb.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:63)
      6. com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:201)
      7. com.mongodb.operation.CountOperation.execute(CountOperation.java:206)
      8. com.mongodb.operation.CountOperation.execute(CountOperation.java:53)
      9. com.mongodb.Mongo.execute(Mongo.java:772)
      10. com.mongodb.Mongo$2.execute(Mongo.java:759)
      11. com.mongodb.MongoCollectionImpl.count(MongoCollectionImpl.java:185)
      12. com.mongodb.MongoCollectionImpl.count(MongoCollectionImpl.java:170)
      12 frames
    3. com.kodcu.provider
      Provider.transfer
      1. com.kodcu.provider.MongoToElasticProvider.getCount(MongoToElasticProvider.java:33)
      2. com.kodcu.provider.Provider.transfer(Provider.java:17)
      2 frames
    4. com.kodcu.main
      Mongolastic.proceedService
      1. com.kodcu.main.Mongolastic.proceedService(Mongolastic.java:61)
      1 frame
    5. Java RT
      Optional.ifPresent
      1. java.util.Optional.ifPresent(Optional.java:159)
      1 frame
    6. com.kodcu.main
      Mongolastic.main
      1. com.kodcu.main.Mongolastic.start(Mongolastic.java:50)
      2. com.kodcu.main.Mongolastic.main(Mongolastic.java:38)
      2 frames