尝试连接到cassandra时出错

时间:2013-12-22 20:33:24

标签: java cassandra hector

我正在尝试创建一个使用Cassandra数据库的Java程序。 我正在'尝试'使用Hector客户端但是当我运行时我遇到了一些错误。我在互联网上搜索过,但可以找到适合我的修复程序(可能是显而易见的事情)。

我在构建路径中包含的Libs:

hector
libthrift-0.9.1
slf4j-simple-1.75

我得到的错误:

[main] INFO me.prettyprint.cassandra.connection.CassandraHostRetryService - Downed Host Retry service started with queue size -1 and retry delay 10s
[main] INFO me.prettyprint.cassandra.service.JmxMonitor - Registering JMX me.prettyprint.cassandra.service_Test Cluster:ServiceType=hector,MonitorType=hector
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/InvalidRequestException
    at me.prettyprint.cassandra.connection.factory.HThriftClientFactoryImpl.createClient(HThriftClientFactoryImpl.java:42)
    at me.prettyprint.cassandra.connection.ConcurrentHClientPool.createClient(ConcurrentHClientPool.java:179)
    at me.prettyprint.cassandra.connection.ConcurrentHClientPool.<init>(ConcurrentHClientPool.java:61)
    at me.prettyprint.cassandra.connection.RoundRobinBalancingPolicy.createConnection(RoundRobinBalancingPolicy.java:68)
    at me.prettyprint.cassandra.connection.HConnectionManager.<init>(HConnectionManager.java:56)
    at me.prettyprint.cassandra.service.AbstractCluster.<init>(AbstractCluster.java:67)
    at me.prettyprint.cassandra.service.ThriftCluster.<init>(ThriftCluster.java:21)
    at me.prettyprint.hector.api.factory.HFactory.createCluster(HFactory.java:197)
    at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:144)
    at me.prettyprint.hector.api.factory.HFactory.getOrCreateCluster(HFactory.java:133)
    at org.codox.lobbyserver.data.CassandraAccess.test(CassandraAccess.java:39)
    at org.codox.lobbyserver.Server.main(Server.java:22)
Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.thrift.InvalidRequestException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 12 more

欢迎任何帮助,如果您需要更多信息,请告诉我。

1 个答案:

答案 0 :(得分:2)

该课程似乎位于cassandra-thrift库中,您可以找到here