Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1160

Driver can't connect to a member of an un-initiated replica set

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.1, 3.0.0
    • Affects Version/s: 2.12.0
    • Component/s: Cluster Management
    • Labels:
      None

      Start mongod like:

      mongod --replSet test
      

      and try to send a command:

              MongoClient mongo = new MongoClient(new MongoClientURI("mongodb://localhost:27001"));
              CommandResult result = mongo.getDB("admin").command("ping");
      

      It fails with this exception:

      Exception in thread "main" com.mongodb.MongoServerSelectionException: Unable to connect to any servers
      

      The root cause is that ClusterDescription.getAny() only returns server descriptions where isPrimary || isSecondary is true.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: