0
votes

(neophyte question) I've just installed cassandra 3.5 (on linux, using the generic package). At present, it's a completely vanilla installation - I haven't modified the conf file and haven't created or added anything yet.

I can connect using cqlsh but not using the javax java driver (version 2.0.2). E.g. if I run

BasicConfigurator.configure();
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); System.out.println("\nCluster name: " + cluster.getClusterName()+"\n");
Session session = cluster.connect();

the result is

0 [main] DEBUG com.datastax.driver.core.Cluster - Starting new cluster with contact points [/127.0.0.1:9042]

Cluster name: cluster1

112 [New I/O worker #1] DEBUG com.datastax.driver.core.Connection - Defuncting connection to /127.0.0.1:9042 com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Unexpected exception triggered (java.lang.IndexOutOfBoundsException: Not enough readable bytes - Need 4, maximum is 0)
at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:601)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
...

The exception is being thrown by cluster.connect().

I suspect I've left something out. Any suggestions would be appreciated. Thanks.

1

1 Answers

2
votes

datastax java driver 2.0.2 is not capable of connecting to cassandra 3.x+ clusters. Upgrading to 3.0.x (i.e. 3.0.2 which is the latest) should resolve this issue.

For future reference you can see what versions of C* are supported with driver versions on the DataStax drivers matrix page.