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

could not find host matching read preference { mode: "primary", tags: [ {} ] }

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 3.0.2
    • Fix Version/s: None
    • Component/s: Connection Management
    • Labels:
      None
    • Environment:
      Linux

      Description

      Hi,

      I am getting "Query failed with error code 133" error which looks like comes when there is no primary node available. For this to handle i tried to set ServerSelectionTimeout/SocketTimeout/SoketkeepAlive it didnt work. Can you please tell me which option do i need to give while creating the mongoClient object, So that i can handle the exception with some timeout in my application. Below is the error:

      nested exception is org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 133 and error message 'could not find host matching read preference { mode: "primary", tags: [ {} ] } fo
      r set shard_B_0' on server mongo001-mongos-b-0:27018; nested exception is com.mongodb.MongoQueryException: Query failed with error code 133 and error message 'could not find host
      matching read preference { mode: "primary", tags: [ {} ] } for set shard_B_0' on server XYZ:27018
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            sulabh84 sulabh
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: