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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.12.1, 3.0.0
    • 2.12.0
    • Cluster Management
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: