cassandra-client-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ssivikt@gmail.com" <ssiv...@gmail.com>
Subject Cassandra-Java-Driver and C* v3.* -- failed to connect
Date Tue, 05 Jan 2016 04:51:16 GMT
Hi All,
I'm trying to connect to C* v3.1.1 cluster.
It works nice with cqlsh

/$ cqlsh//
//Connected to Test Cluster at 127.0.0.1:9042.//
//[cqlsh 5.0.1 | Cassandra 3.1.1 | CQL spec 3.3.1 | Native protocol v4]/

But doesn't work with /cassandra-driver-core/.
I use next mvn deps:

/<dependency>//
//    <groupId>com.datastax.cassandra</groupId>//
//<artifactId>cassandra-driver-core</artifactId>//
//    <version>3.0.0-rc1</version>//
//</dependency>//
//
//<dependency>//
//    <groupId>org.apache.cassandra</groupId>//
//    <artifactId>cassandra-all</artifactId>//
//    <version>3.1.1</version>//
//</dependency>/

And connect in the next code:

/Cluster.Builder builder = Cluster.builder()
         .withProtocolVersion(ProtocolVersion.V4)
         .withPort(9042)
         .addContactPoint("127.0.0.1");

cluster = builder.build();
Metadata metadata = cluster.getMetadata();/

And it doesn't work. I get the exception:
/com.datastax.driver.core.exceptions.NoHostAvailableException: All 
host(s) tried for query failed (tried: /127.0.0.1:9042 
(com.datastax.driver.core.exceptions.TransportException: [/127.0.0.1] 
Cannot connect))//
//    at 
com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:231)//
//    at 
com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:77)//
//    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1382)//
//    at com.datastax.driver.core.Cluster.getMetadata(Cluster.java:393)/

Everything is ok for C* 2.2.4 when I use
/
$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.4 | CQL spec 3.3.1 | Native protocol v4]/

/<dependency>//
//    <groupId>com.datastax.cassandra</groupId>//
//<artifactId>cassandra-driver-core</artifactId>//
//    <version>2.1.9</version>//
//</dependency>//
//
//<dependency>//
//    <groupId>org.apache.cassandra</groupId>//
//    <artifactId>cassandra-all</artifactId>//
//    <version>3.1.1</version>//
//</dependency>/

/Cluster.Builder builder = Cluster.builder()
         .withPort(9042)
         .addContactPoint("127.0.0.1");


/C* java driver isn't ready to use?/
/

-- 
Thanks,
Serj


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message