I am trying to access Cassandra with R via JDBC. Unfortunately, even if I have the jar package cassandra-jdbc-1.2.5.jar correctly installed in /usr/share/cassandra/lib/, containing the file org/apache/cassandra/cql/jdbc/Utils.class, I get the following error:

> library(RJDBC)
Loading required package: DBI
Loading required package: rJava
> cassdrv <- JDBC("org.apache.cassandra.cql.jdbc.CassandraDriver",
+ list.files("/usr/share/cassandra/lib/",pattern="jar$",full.names=T))
>  #Connect to Cassandra node and Keyspace
> casscon <- dbConnect(cassdrv, "jdbc:cassandra://localhost:9160/something")
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.lang.NoClassDefFoundError: Could not initialize class org.apache.cassandra.cql.jdbc.Utils

(Using cassandra 2.1.2, cassandra JDBC 1.2.5, R 3.1.2, CentOS Linux release 7.0.1406)

Any idea on why this happens?

Also, I opened this bug report: https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/issues/detail?id=100

1

There are 1 best solutions below

0
On

If there's a mismatch between the rJava version of java and the version used to compile the Cassandra jars, they may not actually be included in the classpath even if they're reported by .jclassPath().