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." }}}]]]

Stack Overflow | Prayag Upd | 5 months ago
  1. 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." }}}]]]
  2. 0

    Not able to import the data into hive from mongodb using mongo-hadoop connector

    Stack Overflow | 6 months ago | Maddy
    java.io.IOException: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=am0101.test.com:27101, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='dmdbxcc_write', source='dxccdb01', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server am0101.test.com:27101. The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }}}, {address=am0102.test.com:27101, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='dmdbxcc_write', source='dxccdb01', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server am0102.test.com:27101. The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }}}]
  3. 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.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    You should init MongoClient only once.
  6. 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 }}}]

    1 unregistered visitors
    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 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." }}}]

      at com.mongodb.connection.BaseCluster.createTimeoutException()
    2. MongoDB Java Driver
      Mongo$2.execute
      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:210)
      7. com.mongodb.operation.DistinctOperation.execute(DistinctOperation.java:155)
      8. com.mongodb.operation.DistinctOperation.execute(DistinctOperation.java:61)
      9. com.mongodb.Mongo.execute(Mongo.java:773)
      10. com.mongodb.Mongo$2.execute(Mongo.java:760)
      10 frames