使用这行代码创建集群很简单:
Cluster c = HFactory.getOrCreateCluster("MyTest Cluster","localhost:9160");
编译正常,运行时出现以下错误。感谢任何建议。
错误:[java] INFO 连接。CassandraHostRetryService:停机主机重试服务以队列大小 -1 开始,重试延迟 10 秒 [java] 线程“主”java.lang.NoClassDefFoundError 中的异常:org/apache/cassandra/thrift/InvalidRequestException [java ] 在 me.prettyprint.cassandra.connection.ConcurrentHClientPool.(ConcurrentHClientPool.java:48) [java] 在 me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy.createConnection(RoundRobinBalancingPolicy.java:68) [java] 在 me.prettyprint.cassandra .connection.HConnectionManager.(HConnectionManager.java:65) [java] 在 me.prettyprint.cassandra.service.AbstractCluster.(AbstractCluster.java:69) [java] 在 me.prettyprint.cassandra.service.AbstractCluster.(AbstractCluster. java:65) [java] 在 me.prettyprint.cassandra。service.ThriftCluster.(ThriftCluster.java:17) [java] 在 me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:176) [java] 在 me.prettyprint.hector.api.factory.HFactory .getOrCreateCluster(HFactory.java:155) [java] 在 me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:128)