title: No server chosen by WritableServerSelector from cluster
body: <p>As a newbie to MongoDB I'm trying to insert a simple document into my freshly installed mongoDB (v3.2.4). MongoDB Driver 3.2.2 is used.
  Here my minimized code:</p>
  
  <pre><code>public &lt;classname&gt;()
  {
      public static final String COLLECTION_NAME = "logs";
      MongoClient mongoClient = new MongoClient("&lt;server-adress&gt;");
      MongoDatabase db = mongoClient.getDatabase("test");
  
      Document  data = new Document ();
      data.append(&lt;whatever&gt;);
      //...inserting more into document...
      db.getCollection(COLLECTION_NAME).insertOne(data); //collection should be created new
  
      mongoClient.close();
  }
  </code></pre>
  
  <p>The programm is executing, but I'm getting the following errors (and informations) during execution:</p>
  
  <pre><code>Mär 16, 2016 3:50:06 PM com.mongodb.diagnostics.logging.JULLogger log
  INFORMATION: Cluster created with settings {hosts=[&lt;server-adress&gt;:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
  Mär 16, 2016 3:50:06 PM com.mongodb.diagnostics.logging.JULLogger log
  INFORMATION: No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, all=[ServerDescription{address=&lt;server-adress&gt;:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
  Mär 16, 2016 3:50:07 PM com.mongodb.diagnostics.logging.JULLogger log
  INFORMATION: Exception in monitor thread while connecting to server &lt;server-adress&gt;:27017
  com.mongodb.MongoSocketOpenException: Exception opening socket
      at com.mongodb.connection.SocketStream.open(SocketStream.java:63)
      at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114)
      at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.net.ConnectException: Connection refused: connect
      (...) 
      at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50)
      at com.mongodb.connection.SocketStream.open(SocketStream.java:58)
      ... 3 more
  
  Error: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=&lt;server-adress&gt;:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
  </code></pre>
  
  <p>The document is also not inserted.</p>
  
  <p>When I'm commenting the line with the insertOne()-command, it disappears. So I assume it isnt' a problem with the connection, is that right?</p>
  
  <p>I've some ideas:</p>
  
  <ul>
  <li>Does it has something to do with asynchronity? I'd be suprized, I said nowhere that I don't want to execute it synchronous.</li>
  <li>Are any permissions missing  (because of this <code>WritableServerSelector</code>-Thing)?</li>
  <li>Does it has to do with the "test"-database? </li>
  <li>Are there problems with the stand-alone-mode of MongoDB? (I don't want to use replicasets.)</li>
  </ul>
  
  <p>But for all these ideas I couldn't find real proofs...</p>
  
  <p>(Please improve the question-title, I had no better idea...)</p>