java.io.IOException: couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out

JIRA | Leif Mortenson | 6 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Our application runs on machines that are sometimes moved between networks or has its IP address changed. When we create the Mongo instance it is done using the "localhost" host for the Mongo server. The Mongo driver appears to always resolve to an IP on the local subnet. "192.168.0.10" for example. When the network chances however, our applications starts failing with errors like the following because it can no longer connect: jvm 1 | java.io.IOException: couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out jvm 1 | at com.mongodb.DBPort._open(DBPort.java:205) jvm 1 | at com.mongodb.DBPort.go(DBPort.java:94) jvm 1 | at com.mongodb.DBPort.go(DBPort.java:75) jvm 1 | at com.mongodb.DBPort.call(DBPort.java:65) jvm 1 | at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:215) jvm 1 | at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295) jvm 1 | at com.mongodb.DBCursor._check(DBCursor.java:354) jvm 1 | at com.mongodb.DBCursor._hasNext(DBCursor.java:484) jvm 1 | at com.mongodb.DBCursor.hasNext(DBCursor.java:509) jvm 1 | at com.mongodb.jdbc.MongoResultSet.next(MongoResultSet.java:640) ... I have configured the Mongo instance to automatically try to reconnect, but the conversion from "localhost" to "192.168.0.10" only happens once. The only way to get Mongo to reconnect is to restart the Java instance. I assume that there is a reason why the IP is being resolved, but would it be possible to make the driver re-resolve the IP when doing a reconnect? Thanks in advance, Leif

    JIRA | 6 years ago | Leif Mortenson
    java.io.IOException: couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out
  2. 0

    Our application runs on machines that are sometimes moved between networks or has its IP address changed. When we create the Mongo instance it is done using the "localhost" host for the Mongo server. The Mongo driver appears to always resolve to an IP on the local subnet. "192.168.0.10" for example. When the network chances however, our applications starts failing with errors like the following because it can no longer connect: jvm 1 | java.io.IOException: couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out jvm 1 | at com.mongodb.DBPort._open(DBPort.java:205) jvm 1 | at com.mongodb.DBPort.go(DBPort.java:94) jvm 1 | at com.mongodb.DBPort.go(DBPort.java:75) jvm 1 | at com.mongodb.DBPort.call(DBPort.java:65) jvm 1 | at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:215) jvm 1 | at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295) jvm 1 | at com.mongodb.DBCursor._check(DBCursor.java:354) jvm 1 | at com.mongodb.DBCursor._hasNext(DBCursor.java:484) jvm 1 | at com.mongodb.DBCursor.hasNext(DBCursor.java:509) jvm 1 | at com.mongodb.jdbc.MongoResultSet.next(MongoResultSet.java:640) ... I have configured the Mongo instance to automatically try to reconnect, but the conversion from "localhost" to "192.168.0.10" only happens once. The only way to get Mongo to reconnect is to restart the Java instance. I assume that there is a reason why the IP is being resolved, but would it be possible to make the driver re-resolve the IP when doing a reconnect? Thanks in advance, Leif

    JIRA | 6 years ago | Leif Mortenson
    java.io.IOException: couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out
  3. 0

    MongoDB Java API com.mongodb.DBPortPool gotError

    Stack Overflow | 4 years ago | BLenau
    java.io.IOException: couldn't connect to [polaris.cs.wcu.edu/152.30.5.5:12345] bc:java.net.ConnectException: Connec
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Weird error with MongoDb + Java driver

    Stack Overflow | 5 years ago | Kane Nguyen
    java.io.IOException: couldn't connect to [eid/67.215.65.132:27017] bc:java.net.ConnectException: Connection timed out
  6. 0

    MongoDB with Java, cannot get Collection

    Stack Overflow | 5 years ago | Caveman
    java.io.IOException: couldn't connect to [/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect

    Root Cause Analysis

    1. java.io.IOException

      couldn't connect to [io/192.168.0.10:27017] bc:java.net.ConnectException: Operation timed out

      at com.mongodb.DBPort._open()
    2. MongoDB Java Driver
      DBCursor.hasNext
      1. com.mongodb.DBPort._open(DBPort.java:205)
      2. com.mongodb.DBPort.go(DBPort.java:94)
      3. com.mongodb.DBPort.go(DBPort.java:75)
      4. com.mongodb.DBPort.call(DBPort.java:65)
      5. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:215)
      6. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
      7. com.mongodb.DBCursor._check(DBCursor.java:354)
      8. com.mongodb.DBCursor._hasNext(DBCursor.java:484)
      9. com.mongodb.DBCursor.hasNext(DBCursor.java:509)
      9 frames
    3. com.mongodb.jdbc
      MongoResultSet.next
      1. com.mongodb.jdbc.MongoResultSet.next(MongoResultSet.java:640)
      1 frame