There's an example of using Thrift with Java in http://wiki.apache.org/cassandra/ThriftExamples, but I'd recommend using a higher-level client from http://wiki.apache.org/cassandra/ClientOptions instead.
On Wed, Aug 29, 2012 at 2:19 PM, Krishnanand Khambadkone <[email protected]> wrote: > Hi, I am using Cassandra V1.1.4 (apache-cassandra-1.1.4). I have a java > client that tries to connect to cassandra using this code snippet, > > public void prepopulate(String host,int port) throws Exception { > transport = new TFramedTransport(new TSocket(host, port)); > TProtocol protocol = new TBinaryProtocol(transport); // ( the > same class is in thrift and cassandra. I assume it should be the cassandra > one which you: TBinaryProtocol ) > Cassandra.Client client = new Cassandra.Client(protocol); > transport.open(); > insertAllHotels(); > > //also add all hotels to index to help searches > insertByCityIndexes(); > > //pre-populate the DB with POIs > insertAllPointsOfInterest(); > > } > > It is failing with this exception, > > Exception in thread "main" java.lang.IncompatibleClassChangeError: class > org.apache.cassandra.thrift.Cassandra$Client has interface > org.apache.thrift.TServiceClient as super class -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com
