java.io.IOException: couldn't connect to [/0.0.39.87:27017] bc:java.net.SocketException: Invalid argument or cannot assign requested address

JIRA | Peter Robinett | 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

    Some Mongo database servers do not give average accounts access to the {{admin}} database. This causes problems when attempting to make an authorized connection to a normal database. When attempting to connect to such a machine, I get errors like this: {{Jan 11, 2012 3:56:24 PM com.mongodb.DBTCPConnector fetchMaxBsonObjectSize WARNING: null java.io.IOException: couldn't connect to [/0.0.39.87:27017] bc:java.net.SocketException: Invalid argument or cannot assign requested address at com.mongodb.DBPort._open(DBPort.java:206) at com.mongodb.DBPort.go(DBPort.java:94) at com.mongodb.DBPort.go(DBPort.java:75) at com.mongodb.DBPort.findOne(DBPort.java:129) at com.mongodb.DBPort.runCommand(DBPort.java:138) at com.mongodb.DBTCPConnector.fetchMaxBsonObjectSize(DBTCPConnector.java:409) at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:396) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:192) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295) at com.mongodb.DB.command(DB.java:152) at com.mongodb.DB._doauth(DB.java:496) at com.mongodb.DB.authenticate(DB.java:433) at com.mongodb.casbah.MongoDB.authenticate(MongoDB.scala:74)}} I can't say what the exact solution is, but it appears that {{fetchMaxBsonObjectSize()}} returns a {{null}} in this situation, with its unexpected presence (an {{int}} is expected) then causing the exception in later commands like {{DB.authenticate()}}.

    JIRA | 5 years ago | Peter Robinett
    java.io.IOException: couldn't connect to [/0.0.39.87:27017] bc:java.net.SocketException: Invalid argument or cannot assign requested address
  2. 0

    play-morphia connects to mongo during precompile - showstopper on heroku

    GitHub | 6 years ago | knuthaug
    java.io.IOException: couldn't connect to [nikopol.apress.local/32.10.8.124:27017] bc:java.net.ConnectException: Connection refused
  3. 0

    Address is invalid on local machine, or port is not valid on remote machine

    GitHub | 3 years ago | timforgach
    java.io.IOException: couldn't connect to [/127.0.0.1:0] bc:java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to Use RCurl or RMongo via HTTP with Authentication and Self Signed SSL to Read in JSON Data

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

    [JAVA-504] fetchMaxBsonObjectSize incorrectly assumes access to the admin database - MongoDB

    mongodb.org | 2 years ago
    java.io.IOException: couldn't connect to [/127.0.0.1:40017] bc:java.net.ConnectException: Connection refused

  1. abrazeneb 688 times, last 7 months ago
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    couldn't connect to [/0.0.39.87:27017] bc:java.net.SocketException: Invalid argument or cannot assign requested address

    at com.mongodb.DBPort._open()
  2. MongoDB Java Driver
    DB.authenticate
    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.DBTCPConnector.fetchMaxBsonObjectSize(DBTCPConnector.java:409)
    7. com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:396)
    8. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:192)
    9. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
    10. com.mongodb.DB.command(DB.java:152)
    11. com.mongodb.DB._doauth(DB.java:496)
    12. com.mongodb.DB.authenticate(DB.java:433)
    12 frames