2

Just getting into Cassandra. Set up version 2.0.1 and server is running fine and cqlsh connects and properly executes various commands so I know the infrastructure is OK.

I have a small Java test program. I am using a recent Java 7 JDK on OS X 10.8.3 (Darwin):

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

because Cassandra 2.0.1 needs Java 7. I started with these libs as noted in the jdbc wiki page:

cassandra-jdbc-1.2.5.jar
apache-cassandra-thrift-2.0.1.jar
apache-cassandra-clientutil-2.0.1.jar

and upon calling this code

String driverClass = "org.apache.cassandra.cql.jdbc.CassandraDriver";
Class.forName( driverClass ).newInstance();

// mykeyspace was created in the setup example   
java.sql.Connection conn = DriverManager.getConnection("jdbc:cassandra://localhost:9160/mykeyspace");

getConnection() throws a java.lang.NoClassDefFoundError for org/apache/thrift/TEnum. No problem -- I found that in libthrift-0.9.1.jar and added that to the class path. Then I get java.lang.NoClassDefFoundError for org.apache.cassandra.cql.jdbc.AbstractJdbcType. I grep the cassandra-jdbc-1.2.5.jar for AbstractJdbcType but it is not found. I grep for Abstract and I see

org/apache/cassandra/cql/jdbc/AbstractConnection.class
org/apache/cassandra/cql/jdbc/AbstractResultSet.class
org/apache/cassandra/cql/jdbc/AbstractStatement.class

I downloaded the older versions of the JDBC lib (1.1.2 and 1.2.1) but they don't see to contain org.apache.cassandra.cql.jdbc.AbstractJdbcType either.

Googling for org.apache.cassandra.cql.jdbc.AbstractJdbcType reveals it was in the cassandra-all/1.0.0 build? Maybe?

I downloaded the 1.2.5 source and rebuilt it and it fails to compile because getSchema() is not overridden in ManagedConnection.java:

class ManagedConnection extends AbstractConnection implements Connection
...

getSchema() is new in Java 7 java.sql.Connection.

I think I am mixing the wrong versions of jars, JDKs, or possibly 2.0.1 and the jdbc 1.2.5 are not compatible...? Can anyone name the proper set of jars to use JDBC and v2.0.1?

Buzz Moschetti
  • 7,057
  • 3
  • 23
  • 33

2 Answers2

1

No, it is not.

I checked the wiki issues log. Others have reported JDBC 1.2.5 does not work against 2.0.
Also, it seems like a lot of energy is being focused on the Datastax native driver and their (eventual) JDBC layer on top of that. There is interest in both higher performance and the removal of Thrift in this new effort. It seems likely that this will be the future locus of JDBC connectivity to Cassandra 2.0+

Buzz Moschetti
  • 7,057
  • 3
  • 23
  • 33
0

I have rolled back to Cassandra apache-cassandra-1.2.18-bin.tar.gz. Still confronted the same problem. I try to put all the jar *.jar under apache-cassandra-1.2.18/lib into class library. The problem is solved. May the problem disappear after you include some missing libs.

I have no time, but you may try to put the lib under /lib one by one to test which one is need to solve the problem.

Man Pak Hong, Dave manpakhong@hotmail.com

user2093952
  • 21
  • 1
  • 3