【发布时间】:2016-09-19 15:54:04
【问题描述】:
我正在尝试使用现在推荐的 datastax java 驱动程序 3.0 从 java 连接到 cassandra,但出现异常
Caused by: java.lang.IllegalStateException: Detected Guava issue #1635 which indicates that a version of Guava less than 16.01 is in use. This introduces codec resolution issues and potentially other incompatibility issues in the driver. Please upgrade to Guava 16.01 or later.
at com.datastax.driver.core.SanityChecks.checkGuava(SanityChecks.java:62)
at com.datastax.driver.core.SanityChecks.check(SanityChecks.java:36)
at com.datastax.driver.core.Cluster.<clinit>(Cluster.java:67)
我已经下载了zip文件并用maven编译mvn clean package -Dskiptests
在核心驱动程序的目标文件夹中,我找到了一个名为 java-driver-3.0/cassandra-driver-core-3.0.1-SNAPSHOT-shaded.jar 的 jar,我将它添加到我的项目库中。
尝试运行项目会出现上述异常。
尝试如下连接集群
private static Cluster CLUSTER;
private static Session SESSION;
public static Cluster createCluster() {
CLUSTER = Cluster.builder().addContactPoint("127.0.0.1").build();
SESSION = CLUSTER.connect();
ResultSet rs = SESSION.execute("select release_version from system.local");
Row row = rs.one();
System.out.println(row.getString("relese_version"));
return CLUSTER;
}
public static Cluster getCluster() {
if (null == CLUSTER) {
CLUSTER = createCluster();
}
return CLUSTER;
}
我怀疑解决方案是here,但我不知道我应该如何处理该 XML。我是 Maven 的新手,请放轻松。 最后,Hector 客户端是否支持 Cassandra 3.x,因为如果我无法解决上述问题,我不介意使用 hector。
【问题讨论】:
标签: java maven cassandra datastax-java-driver