title: "All host(s) tried for query failed" Error
body: <p>My Java code is as follows:</p>
  
  <pre><code>import com.datastax.driver.core.Cluster;
  import com.datastax.driver.core.Metadata;
  import com.datastax.driver.core.Session;
  
  public class CustomerController {
  
      public void execute() {
          Cluster cluster = Cluster.builder()
                  .addContactPoints("172.16.11.126", "172.16.11.130")
                  .withPort(9042)
                  .build();
          Session session = cluster.connect();
          String command = "drop keyspace if exists bookstore";
          session.execute(command);
          cluster.close();
      }
  }
  </code></pre>
  
  <p>When I run the code, I get the following error:</p>
  
  <blockquote>
    <p>Exception in thread "main"
    com.datastax.driver.core.exceptions.NoHostAvailableException: All
    host(s) tried for query failed (tried: /172.16.11.130
    (com.datastax.driver.core.TransportException: [/172.16.11.130] Cannot
    connect), /172.16.11.126 (com.datastax.driver.core.TransportException:
        [/172.16.11.126] Cannot connect))<br>
    at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:195)<br>
    at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78)<br>
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1029)<br>
    at com.datastax.driver.core.Cluster.init(Cluster.java:120)<br>
    at com.datastax.driver.core.Cluster.connect(Cluster.java:197)<br>
    at com.pragatisoftware.datastax99.app.CustomerController.execute(CustomerController.java:12)<br>
    at com.pragatisoftware.datastax99.app.Application.run(Application.java:10)<br>
    at com.pragatisoftware.datastax99.app.Application.main(Application.java:6)</p>
  </blockquote>
  
  <p>Environment information:</p>
  
  <ul>
  <li>Ubuntu machine</li>
  <li>Eclipse Luna</li>
  <li>Java 1.7</li>
  <li>Cassandra 2.0.11</li>
  </ul>
  
  <p>In cassandra.yaml:</p>
  
  <pre><code>native_transport_port: 9042
  </code></pre>
  
  <p>Cassandra is running on both the IP addresses provided above (172.16.11.130 and 172.16.11.126) and I am able to connect using CQLSH to both the machines.</p>
  
  <p>By the way, the same code (with the appropriate IP address) worked on a Windows machine, using Cassandra 2.0.9.</p>