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

  1. scale7-core-1.3.0.jar
  2. scale7-pelops-0.912-0.7.0-rc4-1.jar
  3. 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)
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top