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:
我正在尝试通过JDBC访问Cassandra。不幸的是,即使我有jar包cassandra-jdbc-1.2.5。jar正确地安装在/usr/share/cassandra/lib/中,包含文件org/apache/cassandra/cql/jdbc/Utils。类,我得到以下错误:
> 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)
(使用cassandra 2.1.2, cassjdbc 1.2.5, R 3.1.2, CentOS Linux发行版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
另外,我打开了这个bug报告:https://code.google.com/a/apache-extras.org/p/cassandra-jdbc/issues/detail?id=100
1 个解决方案
#1
0
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()
.
如果java的rJava版本与用来编译Cassandra jar的版本之间存在不匹配,那么即使. jclasspath()报告了它们,它们也可能不包含在类路径中。
#1
0
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()
.
如果java的rJava版本与用来编译Cassandra jar的版本之间存在不匹配,那么即使. jclasspath()报告了它们,它们也可能不包含在类路径中。