title: Error NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042
body: <p>I Recently started learning cassandra and going through online tutorials for cassandra with DataStax Java Drivers.  I am simply trying to connect a localhost node on my laptop.</p>
  
  <p>Setup Details -</p>
  
  <p>OS - Windows 7</p>
  
  <p>Cassandra Version - Cassandra version: 2.1-SNAPSHOT</p>
  
  <p>DataStax java driver version - 3.1.0</p>
  
  <p>I could able to connect to local node by using CQLSH and cassandra-cli clients.
  I can also see the default keyspace system and system_traces.
  Below is the cassandra server log</p>
  
  <pre><code>INFO  12:12:51 Node localhost/127.0.0.1 state jump to normal
  INFO  12:12:51 Startup completed! Now serving reads.
  INFO  12:12:51 Starting listening for CQL clients on /0.0.0.0:9042...
  INFO  12:12:51 Binding thrift service to /0.0.0.0:9160
  INFO  12:12:51 Using TFramedTransport with a max frame size of 15728640 bytes.
  INFO  12:12:51 Using synchronous/threadpool thrift server on 0.0.0.0 : 9160
  INFO  12:12:51 Listening for thrift clients...
  </code></pre>
  
  <p>I am trying below simple code -</p>
  
  <pre><code>        Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
          Metadata metadata = cluster.getMetadata();
  </code></pre>
  
  <p>This code throws below exception - Part of the Trace</p>
  
  <pre><code>com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily schema_usertypes))
  at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)
  </code></pre>
  
  <p>I have been through all the previously asked question. Most of answers suggests changing the configuration in cassandra.yaml file. </p>
  
  <p>My cassandra.yaml configuration is - </p>
  
  <pre><code>start_native_transport: true
  native_transport_port: 9042
  listen_address: localhost
  rpc_address: 0.0.0.0
  rpc_port: 9160
  </code></pre>
  
  <p>Most of the answers suggests to use actual IP address of machine at rpc_address, which I tried but did not worked.</p>
  
  <p>Here are the Questions I been through -
  <a href="https://stackoverflow.com/questions/18146781/why-cant-i-connect-to-cassandra">Question One</a>, <a href="https://stackoverflow.com/questions/35254443/error-on-127-0-0-1-connection-com-datastax-driver-core-transportexception-1">Question two</a> ,<a href="https://stackoverflow.com/questions/16783725/error-while-connecting-to-cassandra-using-java-driver-for-apache-cassandra-1-0-f">Question three</a>, <a href="https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/8m1hPFjcaFc" rel="nofollow noreferrer">Topic</a> ,<a href="https://github.com/datastax/java-driver/wiki/Connection-requirements" rel="nofollow noreferrer">Connection requirement</a>, <a href="https://stackoverflow.com/questions/18724334/cant-connect-to-cassandra-nohostavailableexception">Question four</a>.</p>
  
  <p><a href="http://www.datastax.com/dev/blog/java-driver-2-1-2-native-protocol-v3" rel="nofollow noreferrer">This page</a>  lists compatibility of Java DataStax drivers with cassandra versions, so I changed the driver version to 2.1.1 (As I am using cassandra 2.1), but it did not worked. </p>
  
  <p>Please suggest what could be wrong.</p>