【问题标题】:Cassandra- Pelops :Getting No Such Method error while trying to insert data into cassandraCassandra-Pelops:尝试将数据插入 cassandra 时出现没有这样的方法错误
【发布时间】:2012-01-14 05:08:08
【问题描述】:

当我尝试使用 pelops api 将数据插入 cassandra 时出现以下错误

 java.lang.NoSuchMethodError: org.apache.cassandra.thrift.Column.<init>(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;J)V

我正在使用以下罐子

  1. scale7-core-1.3.0.jar
  2. scale7-pelops-0.912-0.7.0-rc4-1.jar
  3. cassandra-1.0.5的lib目录下的所有jar

调用以下函数会导致异常

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)

【问题讨论】:

    标签: jar cassandra nosuchmethoderror hector pelops


    【解决方案1】:

    您将针对 cassandra-1.0.5 构建的节俭绑定与针对更旧的节俭绑定构建的 pelops 版本混合在一起。 api 本身是向后兼容的,但你不能像这样混合绑定。你有两个选择:

    最好的选择可能是升级到更新版本的 pelops。根据 github:https://github.com/s7/scale7-pelops,有 1.0.x 版本可用的快照版本。

    如果由于某种原因您需要使用上面使用的 pelops 版本,那么您还需要使用该版本所依赖的 cassandra thrift 绑定,而不是针对 cassandra 1.0.5 构建的绑定。

    【讨论】:

      猜你喜欢
      • 2016-09-10
      • 2013-03-29
      • 2020-08-10
      • 2020-09-20
      • 2012-06-23
      • 1970-01-01
      • 2019-04-16
      相关资源
      最近更新 更多