com.mongodb.MongoException: can't find a master

JIRA | Gui Forget | 3 years ago
  1. 0

    Forcing connection to a local mongos + verbose logging that specifies

    Google Groups | 3 years ago | Guillaume Forget
    com.mongodb.MongoException: can't find a master
  2. 0

    I'm initializing the Mongo instance (Java object) with the following options: 2013-10-24 21:30:35,906 [http-8080-exec-6] INFO Mongo{authority=MongoAuthority{type=Set, serverAddresses=[localhost/127.0.0.1:27027, HOST1/10.149.12.79:27027, HOST2/10.154.149.70:27027, HOST3/10.158.33.16:27027], credentials={credentials={}}}, options=MongoOptions{description='null', connectionsPerHost=40, threadsAllowedToBlockForConnectionMultiplier=5, maxWaitTime=10000, connectTimeout=10000, socketTimeout=30000, socketKeepAlive=false, autoConnectRetry=false, maxAutoConnectRetryTime=0, slaveOk=false, readPreference=secondaryPreferred : { "tags" : [ { "aws-az" : "us-east-1e"}]}, dbDecoderFactory=DefaultDBDecoder.DefaultFactory, dbEncoderFactory=DefaultDBEncoder.DefaultFactory, safe=false, w=0, wtimeout=0, fsync=false, j=false, socketFactory=javax.net.DefaultSocketFactory@20c66135, cursorFinalizerEnabled=true, writeConcern=WriteConcern { "getlasterror" : 1} / (Continue Inserting on Errors? false), alwaysUseMBeans=false}} HOST1, HOST2 and HOST3 are dead when I start due to a bad config. And I get the following error: com.mongodb.MongoException: can't find a master at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:517) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:134) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:115) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:248) If I start with the following options: 2013-10-24 21:43:13,608 [http-8080-exec-19] INFO Mongo{authority=MongoAuthority{type=Set, serverAddresses=[localhost/127.0.0.1:27027], credentials={credentials={}}}, options=MongoOptions{description='null', connectionsPerHost=40, threadsAllowedToBlockForConnectionMultiplier=5, maxWaitTime=10000, connectTimeout=10000, socketTimeout=30000, socketKeepAlive=false, autoConnectRetry=false, maxAutoConnectRetryTime=0, slaveOk=false, readPreference=secondaryPreferred : { "tags" : [ { "aws-az" : "us-east-1e"}]}, dbDecoderFactory=DefaultDBDecoder.DefaultFactory, dbEncoderFactory=DefaultDBEncoder.DefaultFactory, safe=false, w=0, wtimeout=0, fsync=false, j=false, socketFactory=javax.net.DefaultSocketFactory@2cc29d3d, cursorFinalizerEnabled=true, writeConcern=WriteConcern { "getlasterror" : 1} / (Continue Inserting on Errors? false), alwaysUseMBeans=false}} Then it starts fine. It's as if it ignored the localhost entry in the first case. I can reproduce this at will.

    JIRA | 3 years ago | Gui Forget
    com.mongodb.MongoException: can't find a master
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Can't configure Java Client Driver timeout

    Google Groups | 5 years ago | Diogo Vernier
    uol.newsfeed.commons.exception.DBCollectionWrapperException: An error occurred while executing the query null in the collection feed

    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.MongoException

      can't find a master

      at com.mongodb.DBTCPConnector.checkMaster()
    2. MongoDB Java Driver
      DBApiLayer$MyCollection.insert
      1. com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:517)
      2. com.mongodb.DBTCPConnector.say(DBTCPConnector.java:134)
      3. com.mongodb.DBTCPConnector.say(DBTCPConnector.java:115)
      4. com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:248)
      4 frames