FAQ

[mongodb-user] Mongo Java Driver Failing to Connect to MongoD

Ajinkya prabhune
Nov 18, 2011 at 5:11 pm
Hello All,

I have a java project and am connecting to mongod process using the
following
code

private static Mongo mongoObj = null;
private static DB db = null;

mongoObj = new Mongo("localhost", 27017 );
db = mongoObj.getDB( "MyDataBase" );


I was using this code for the last 4months and have created thousands of
documents but suddenly I am unable to connect to MongoD process.
But when I change from IP address to use "localhost" it works.


java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
bc:java.net.Conne
ctException: Connection timed out: connect
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
:419)
at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
at com.mongodb.DBCollection.insert(DBCollection.java:80)








--

Thank you and Regards
Ajinkya Prabhune

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
reply

Search Discussions

8 responses

  • Brendan W. McAdams at Nov 18, 2011 at 5:22 pm
    Are you running on Mac OS by chance?

    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.

    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1

    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune wrote:


    Hello All,

    I have a java project and am connecting to mongod process using the
    following
    code

    private static Mongo mongoObj = null;
    private static DB db = null;

    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );


    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.


    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)








    --

    Thank you and Regards
    Ajinkya Prabhune

    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Ajax at Nov 19, 2011 at 9:58 am
    Hi,

    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.

    Could you please let me know if this is a known issue ? and there is a
    solution to it.


    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?

    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.

    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1

    Check that the startup option or config value bind_ip isn't set.

    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <







    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Eliot Horowitz at Nov 19, 2011 at 10:51 pm
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?
    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,

    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.

    Could you please let me know if this is a known issue ? and there is a
    solution to it.


    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?

    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.

    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1

    Check that the startup option or config value bind_ip isn't set.

    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <







    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Ajax at Nov 20, 2011 at 2:33 pm
    HI,

    Thanks for the suggestions..
    But no the ip has not changed and neither the firewall settings...
    But yes I updated my Windows7 version... Can that cause an issue ?

    Thanks..
    Ajinkya
    On Nov 19, 11:51 pm, Eliot Horowitz wrote:
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?






    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,
    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.
    Could you please let me know if this is a known issue ? and there is a
    solution to it.
    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?
    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.
    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1
    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <
    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Scott Hernandez at Nov 20, 2011 at 2:42 pm
    Try connecting specifically to 127.0.0.1

    Does that work well?
    On Sun, Nov 20, 2011 at 9:33 AM, ajax wrote:
    HI,

    Thanks for the suggestions..
    But no the ip has not changed and neither the firewall settings...
    But yes I updated my Windows7 version... Can that cause an issue ?

    Thanks..
    Ajinkya
    On Nov 19, 11:51 pm, Eliot Horowitz wrote:
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?






    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,
    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.
    Could you please let me know if this is a known issue ? and there is a
    solution to it.
    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?
    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.
    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1
    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <
    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Ajax at Nov 21, 2011 at 10:28 am
    Hi Scott,

    Yes 127.0.0.1 works. But with the IP it fails
    could you please let me know what might be the issue.

    Thanks
    Ajinkya
    On Nov 20, 3:41 pm, Scott Hernandez wrote:
    Try connecting specifically to 127.0.0.1

    Does that work well?






    On Sun, Nov 20, 2011 at 9:33 AM, ajax wrote:
    HI,
    Thanks for the suggestions..
    But no the ip has not changed and neither the firewall settings...
    But yes I updated my Windows7 version... Can that cause an issue ?
    Thanks..
    Ajinkya
    On Nov 19, 11:51 pm, Eliot Horowitz wrote:
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?
    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,
    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.
    Could you please let me know if this is a known issue ? and there is a
    solution to it.
    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?
    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.
    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1
    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <
    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Nat at Nov 21, 2011 at 10:31 am
    Very likely that it's something to do with your firewall setting. Can you check whether you allow mongod.exe to listen to connections?
    -----Original Message-----
    From: ajax <ajinkya.prabhune@gmail.com>
    Sender: mongodb-user@googlegroups.com
    Date: Mon, 21 Nov 2011 02:27:37
    To: mongodb-user<mongodb-user@googlegroups.com>
    Reply-To: mongodb-user@googlegroups.com
    Subject: [mongodb-user] Re: Mongo Java Driver Failing to Connect to MongoD

    Hi Scott,

    Yes 127.0.0.1 works. But with the IP it fails
    could you please let me know what might be the issue.

    Thanks
    Ajinkya
    On Nov 20, 3:41 pm, Scott Hernandez wrote:
    Try connecting specifically to 127.0.0.1

    Does that work well?






    On Sun, Nov 20, 2011 at 9:33 AM, ajax wrote:
    HI,
    Thanks for the suggestions..
    But no the ip has not changed and neither the firewall settings...
    But yes I updated my Windows7 version... Can that cause an issue ?
    Thanks..
    Ajinkya
    On Nov 19, 11:51 pm, Eliot Horowitz wrote:
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?
    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,
    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.
    Could you please let me know if this is a known issue ? and there is a
    solution to it.
    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?
    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.
    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1
    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <
    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
  • Ajax at Nov 21, 2011 at 4:59 pm
    Hi Nat,
    Yes it works I added mongod.exe in the firewall allowed apps list and
    it worked.Thanks a lot for ur help. :-) really appreciated
    Cheers Ajinkya
    On Nov 21, 11:31 am, "Nat" wrote:
    Very likely that it's something to do with your firewall setting. Can you check whether you allow mongod.exe to listen to connections?







    -----Original Message-----
    From: ajax <ajinkya.prabh...@gmail.com>
    Sender: mongodb-user@googlegroups.com
    Date: Mon, 21 Nov 2011 02:27:37
    To: mongodb-user<mongodb-user@googlegroups.com>
    Reply-To: mongodb-user@googlegroups.com
    Subject: [mongodb-user] Re: Mongo Java Driver Failing to Connect to MongoD

    Hi Scott,

    Yes 127.0.0.1 works. But with the IP it fails
    could you please let me know what might be the issue.

    Thanks
    Ajinkya
    On Nov 20, 3:41 pm, Scott Hernandez wrote:
    Try connecting specifically to 127.0.0.1
    Does that work well?
    On Sun, Nov 20, 2011 at 9:33 AM, ajax wrote:
    HI,
    Thanks for the suggestions..
    But no the ip has not changed and neither the firewall settings...
    But yes I updated my Windows7 version... Can that cause an issue ?
    Thanks..
    Ajinkya
    On Nov 19, 11:51 pm, Eliot Horowitz wrote:
    Its probably a firewall or ip change on the machine.
    Are you sure the ip is the same?
    On Sat, Nov 19, 2011 at 4:58 AM, ajax wrote:
    Hi,
    I am using Windows 7 OS.
    And I am clueless why suddenly it has stopped.
    Could you please let me know if this is a known issue ? and there is a
    solution to it.
    Thanks
    Ajinkza
    On Nov 18, 12:22 pm, "Brendan W. McAdams" wrote:
    Are you running on Mac OS by chance?
    There is a known issue (caused by an oddity in the code of how Java for Mac
    looks up network addresses) that makes "localhost" resolve to the PUBLIC IP
    of your machine rather than 127.0.0.1 … if your Mongo instance is only
    listening to 127.0.0.1, you'll get an issue along these lines.
    Otherwise, check what interfaces your Mongo server is set to listen on.
    Many distributions start up listening only on 127.0.0.1
    Check that the startup option or config value bind_ip isn't set.
    On Fri, Nov 18, 2011 at 5:11 PM, ajinkya prabhune <
    ajinkya.prabh...@gmail.com> wrote:
    Hello All,
    I have a java project and am connecting to  mongod process using the
    following
    code
    private static Mongo mongoObj = null;
    private static DB db = null;
    mongoObj = new Mongo("localhost", 27017 );
    db = mongoObj.getDB( "MyDataBase" );
    I was using this code for the last 4months and have created thousands of
    documents but suddenly I am unable to connect to MongoD process.
    But when I change from IP address to use "localhost" it works.
    java.io.IOException: couldn't connect to [/"IPADDRESS OF THE MACHINE":27017]
    bc:java.net.Conne
    ctException: Connection timed out: connect
    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
    :419)
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:406)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:144)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:137)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:255)
    at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:210)
    at com.mongodb.DBCollection.insert(DBCollection.java:80)
    --
    Thank you and Regards
    Ajinkya Prabhune
    --
    You received this message because you are subscribed to the Google Groups
    "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Related Discussions

Discussion Navigation
viewthread | post