Cassandra- Pelops:尝试将数据插入 cassandra 时出现“没有此类方法”错误
当我尝试使用 pelops api 将数据插入 cassandra 时出现以下错误
java.lang.NoSuchMethodError: org.apache.cassandra.thrift.Column.<init>(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;J)V
我正在使用以下 jars
- scale7-core-1.3.0.jar
- scale7-pelops-0.912-0.7.0-rc4-1.jar
- lib 中的所有 jars cassandra-1.0.5 目录
下调用以下函数导致异常
public void writeToBatch(String columnFamily, String rowKey, String colmName,String value, int ttl)
{
this.mutator.writeColumn(columnFamily, rowKey,
mutator.newColumn(colmName, value, ttl));
}
错误堆栈如下:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.cassandra.thrift.Column.<init>(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;J)V
at org.scale7.cassandra.pelops.Mutator.newColumn(Mutator.java:625)
at org.scale7.cassandra.pelops.Mutator.newColumn(Mutator.java:562)
at com.audienceadnetwork.cassandra.sstablewriter.utils.PelopsClient.writeToBatch(Unknown Source)
I am getting following error when m trying to insert data into cassandra using pelops api
java.lang.NoSuchMethodError: org.apache.cassandra.thrift.Column.<init>(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;J)V
I am Using following jars
- scale7-core-1.3.0.jar
- scale7-pelops-0.912-0.7.0-rc4-1.jar
- All the jars in lib directory of cassandra-1.0.5
Call to following function causes a exception
public void writeToBatch(String columnFamily, String rowKey, String colmName,String value, int ttl)
{
this.mutator.writeColumn(columnFamily, rowKey,
mutator.newColumn(colmName, value, ttl));
}
Error stack is as follows:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.cassandra.thrift.Column.<init>(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;J)V
at org.scale7.cassandra.pelops.Mutator.newColumn(Mutator.java:625)
at org.scale7.cassandra.pelops.Mutator.newColumn(Mutator.java:562)
at com.audienceadnetwork.cassandra.sstablewriter.utils.PelopsClient.writeToBatch(Unknown Source)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在将针对 cassandra-1.0.5 构建的 thrift 绑定与针对更旧的 thrift 绑定构建的 pelops 版本混合在一起。 api 本身是向后兼容的,但你不能像这样混合绑定。您有两个选择:
最好的选择可能是升级到较新版本的 pelops。根据其 github,有适用于 1.0.x 版本的快照版本: https://github.com/s7 /scale7-pelops。
如果由于某种原因您需要使用上面使用的 pelops 版本,那么您还需要使用该版本所依赖的 cassandra thrift 绑定,而不是针对 cassandra 1.0.5 构建的绑定。
You are mixing the thrift bindings built against cassandra-1.0.5 with a version of pelops built against much older thrift bindings. The api itself is backwards compatible but you can't mix bindings like this. You have two options:
The best option is probably to upgrade to a newer version of pelops. There are snapshot versions available for the 1.0.x releases according to their github: https://github.com/s7/scale7-pelops.
If for some reason you need to use the version of pelops used above then you also need to use the cassandra thrift bindings that version depends on, rather than the ones built against cassandra 1.0.5.