java.io.IOException: couldn't connect to [kevinw-mbp/10.180.131.72:27017] bc:java.net.ConnectException: Connection refused

JIRA | Kevin Williams | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Console output at the end. Running MongoDB locally, bound to localhost. The client keeps logging ReplicaSetStatus updates - that's problem #1. Then the client gets a connection refused from my NIC IP address - why is it trying to connect that way? Problem #2. Then, it thinks the replicaset master (there is no replica set, mind you) has moved from localhost to localhost, but thinks that server is down. That's problems #3 and #4. Then, it thinks the server is down from that point forward. My app will fail until I restart the app. Then this whole process starts over just a couple of minutes later. Running our app from Ant eventually gives me the following output: [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Sep 29, 2011 12:50:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen up: localhost:27017 [java] Starting IDM Server on port 3002 [java] Sep 29, 2011 12:55:19 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen down: localhost:27017 [java] java.io.IOException: couldn't connect to [kevinw-mbp/10.180.131.72:27017] bc:java.net.ConnectException: Connection refused [java] at com.mongodb.DBPort._open(DBPort.java:206) [java] at com.mongodb.DBPort.go(DBPort.java:94) [java] at com.mongodb.DBPort.go(DBPort.java:75) [java] at com.mongodb.DBPort.findOne(DBPort.java:129) [java] at com.mongodb.DBPort.runCommand(DBPort.java:138) [java] at com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:162) [java] at com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:156) [java] at com.mongodb.ReplicaSetStatus.ensureMaster(ReplicaSetStatus.java:311) [java] at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:393) [java] at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:292) [java] Sep 29, 2011 12:55:19 PM com.mongodb.DBTCPConnector _set [java] WARNING: Master switching from localhost:27017 to localhost:27017 [java] Sep 29, 2011 12:55:29 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen down: localhost:27017 [java] Sep 29, 2011 12:55:59 PM com.mongodb.ReplicaSetStatus$Node update [java] WARNING: Server seen down: localhost:27017

    JIRA | 5 years ago | Kevin Williams
    java.io.IOException: couldn't connect to [kevinw-mbp/10.180.131.72:27017] bc:java.net.ConnectException: Connection refused
  2. 0

    Endless replicaset connection error with spring data support and mongodb

    Stack Overflow | 6 years ago | Arun P Johny
    java.io.IOException: couldn't connect to [/192.168.1.42:27017] bc:java.net.ConnectException: Connection refused: connect
  3. 0

    Endless MongoDB ReplicaSetStatus updater exceptions using the Java driver in Spring

    Stack Overflow | 6 years ago | icchanobot
    java.io.IOException: couldn't connect to [/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    These error messages are much too noisy. The user does not need to see the stack trace because these messages are expected when a server is down and they originate from the RS monitor thread. The driver should look at the IOException and only display the message (take the source msg?). *Less Noise* 06-30-2012 20:42:00 [ReplicaSetStatus:Updater] WARN com.mongodb.ReplicaSetStatus.mmsconfig1 [update:580] - Server seen down: server.something.com/10.137.128.62:27018 - bc:java.net.SocketTimeoutException: connect timed out *Current* 06-30-2012 20:42:00 [ReplicaSetStatus:Updater] WARN com.mongodb.ReplicaSetStatus.mmsconfig1 [update:580] - Server seen down: server.something.com/10.137.128.62:27018 java.io.IOException: couldn't connect to [server.something.com/10.137.128.62:27018] bc:java.net.SocketTimeoutException: connect timed out at com.mongodb.DBPort._open(DBPort.java:222) ~[mongo.jar:na] at com.mongodb.DBPort.go(DBPort.java:111) ~[mongo.jar:na] at com.mongodb.DBPort.go(DBPort.java:92) ~[mongo.jar:na] at com.mongodb.DBPort.findOne(DBPort.java:145) ~[mongo.jar:na] at com.mongodb.DBPort.runCommand(DBPort.java:156) ~[mongo.jar:na] at com.mongodb.ReplicaSetStatus$UpdatableNode.update(ReplicaSetStatus.java:507) ~[mongo.jar:na] at com.mongodb.ReplicaSetStatus$Updater.updateAll(ReplicaSetStatus.java:708) [mongo.jar:na] at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:674) [mongo.jar:na]

    JIRA | 5 years ago | Ryan Nitz
    java.io.IOException: couldn't connect to [server.something.com/10.137.128.62:27018] bc:java.net.SocketTimeoutException: connect timed out

    Root Cause Analysis

    1. java.io.IOException

      couldn't connect to [kevinw-mbp/10.180.131.72:27017] bc:java.net.ConnectException: Connection refused

      at com.mongodb.DBPort._open()
    2. MongoDB Java Driver
      ReplicaSetStatus$Updater.run
      1. com.mongodb.DBPort._open(DBPort.java:206)
      2. com.mongodb.DBPort.go(DBPort.java:94)
      3. com.mongodb.DBPort.go(DBPort.java:75)
      4. com.mongodb.DBPort.findOne(DBPort.java:129)
      5. com.mongodb.DBPort.runCommand(DBPort.java:138)
      6. com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:162)
      7. com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:156)
      8. com.mongodb.ReplicaSetStatus.ensureMaster(ReplicaSetStatus.java:311)
      9. com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:393)
      10. com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:292)
      10 frames