使用以下代码行创建集群非常简单:
Cluster c = HFactory.getOrCreateCluster("MyTest Cluster","localhost:9160");
编译好,运行时,我收到以下错误。感谢任何建议。
错误:[java] INFO connection.CassandraHostRetryService:Downed Host 重试服务以队列大小-1开始,重试延迟10秒 [java]线程“main”中的异常java.lang.NoClassDefFoundError:org / apache / cassandra / thrift / InvalidRequestException [java] at me.prettyprint.cassandra.connection.ConcurrentHClientPool。(ConcurrentHClientPool.java:48) [java] at me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy.createConnection(RoundRobinBalancingPolicy.java:68) [java] at me.prettyprint.cassandra.connection.HConnectionManager。(HConnectionManager.java:65) [java] at me.prettyprint.cassandra.service.AbstractCluster。(AbstractCluster.java:69) [java] at me.prettyprint.cassandra.service.AbstractCluster。(AbstractCluster.java:65) [java] at me.prettyprint.cassandra.service.ThriftCluster。(ThriftCluster.java:17) [java] at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:176) [java] at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:155) [java] at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:128)
答案 0 :(得分:0)
它没有在你的类路径上找到节俭。如果您正在使用Maven和Eclipse,如果您没有包含cassandra-thrift依赖项,或者如果您执行了最近的mvn eclipse:eclipse并且需要“刷新”您的项目,您可能会看到这一点。