title: mongo couldn't connect to [localhost/127.0.0.1:27017]
body: <p>I'm getting the following error:</p>
  
  <pre><code>נוב 08, 2013 12:05:46 PM com.mongodb.DBTCPConnector initDirectConnection
  WARNING: Exception executing isMaster command on localhost/127.0.0.1:27017
  java.io.IOException: couldn't connect to [localhost/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect
      at com.mongodb.DBPort._open(DBPort.java:214)
      at com.mongodb.DBPort.go(DBPort.java:107)
      at com.mongodb.DBPort.go(DBPort.java:88)
      at com.mongodb.DBPort.findOne(DBPort.java:143)
      at com.mongodb.DBPort.runCommand(DBPort.java:148)
      at com.mongodb.DBTCPConnector.initDirectConnection(DBTCPConnector.java:548)
      at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:527)
      at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:277)
      at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:295)
      at com.mongodb.DB.getCollectionNames(DB.java:412)
      at Main.Main.main(Main.java:26)
  </code></pre>
  
  <p>my code is simple (my first time with mongo):</p>
  
  <pre><code>        MongoClient Client = new MongoClient( "localhost" , 27017 );
  
          DB db = Client.getDB("qw");
          DBCollection coll[] = new DBCollection[4];
          Set&lt;String&gt; colls = db.getCollectionNames();
          for(String s: colls)
              System.out.println(s);
  </code></pre>
  
  <p>what is the problem?</p>