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=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]

GitHub | BTGBIMobile | 3 weeks ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    java mongo连接问题,一直超时,原因不知道在哪

    oschina.net | 1 year ago
    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=REPLICA_SET, servers=[{address=10.96.0.18:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=10.96.0.18:27018, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}, {address=10.96.0.7:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
  2. 0

    ExtentX 1.0 with mongodb issue

    GitHub | 3 weeks ago | BTGBIMobile
    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=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
  3. 0

    MongoDB "Exception authenticating MongoCredential" using java-driver

    Stack Overflow | 6 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." }}}]]]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java MongoCredential 连接Mongodb3.0.3问题_dbdao吧_百度贴吧

    baidu.com | 1 year ago
    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=REPLICA_SET, servers=[{address=zcdb-1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: zcdb-1}, caused by {java.net.UnknownHostException: zcdb-1}}, {address=zcdb-2:27018, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: zcdb-2}, caused by {java.net.UnknownHostException: zcdb-2}}]
  6. 0

    mongodb-user - [mongodb-user] Java driver cannot connect to MongoDB over SSL while MongoDB CLI can - msg#00522 - Recent Discussion OSDir.com

    osdir.com | 8 months ago
    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=mon0101.pre2.zeldalabs.internal:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}]
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=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]

    at com.mongodb.connection.BaseCluster.createTimeoutException()
  2. MongoDB Java Driver
    FindIterableImpl.first
    1. com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:375)
    2. com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:104)
    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:212)
    7. com.mongodb.operation.FindOperation.execute(FindOperation.java:483)
    8. com.mongodb.operation.FindOperation.execute(FindOperation.java:80)
    9. com.mongodb.Mongo.execute(Mongo.java:818)
    10. com.mongodb.Mongo$2.execute(Mongo.java:805)
    11. com.mongodb.FindIterableImpl$FindOperationIterable.first(FindIterableImpl.java:207)
    12. com.mongodb.FindIterableImpl.first(FindIterableImpl.java:148)
    12 frames
  3. com.aventstack.extentreports
    Report.attach
    1. com.aventstack.extentreports.reporter.ExtentXReporter.setupProject(ExtentXReporter.java:199)
    2. com.aventstack.extentreports.reporter.ExtentXReporter.start(ExtentXReporter.java:165)
    3. com.aventstack.extentreports.Report.attach(Report.java:51)
    3 frames
  4. Java RT
    ReferencePipeline$Head.forEach
    1. java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
    2. java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
    2 frames
  5. com.aventstack.extentreports
    ExtentReports.attachReporter
    1. com.aventstack.extentreports.ExtentReports.attachReporter(ExtentReports.java:66)
    1 frame