title: Error while connecting to Cassandra using Java Driver for Apache Cassandra 1.0 from com.example.cassandra
body: <p>While connecting to Cassandra client using java driver for Cannsandra by DataStax, it is throwing following error..</p>
  
  <p><strong>Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: [/127.0.0.1])</strong></p>
  
  <p>Please suggest...</p>
  
  <p>Thanks!</p>
  
  <p>My java code is like this:</p>
  
  <pre><code>package com.example.cassandra;
  
  import com.datastax.driver.core.Cluster;
  import com.datastax.driver.core.Host;
  import com.datastax.driver.core.Metadata;
  
  public class SimpleClient {
  
  private Cluster cluster;
  
  public void connect(String node){
  
      cluster = Cluster.builder().addContactPoint(node).build();
      Metadata metadata = cluster.getMetadata();
      System.out.println(metadata.getClusterName());
  }   
  
  
  public void close()
  {
  cluster.shutdown();
  }
  
  public static void main(String args[]) {
  
  SimpleClient client = new SimpleClient();
  client.connect("127.0.0.1");
  client.close();
  }
  </code></pre>