On Fri, Nov 5, 2010 at 9:50 PM, CassUser CassUser <cassu...@gmail.com> wrote:
> I agree and we will move to hector  at some point, but we have some legacy
> code we need to convert to the new api.  What am I doing wrong in the code I
> posted?
>
>
> On Fri, Nov 5, 2010 at 5:45 PM, Jonathan Ellis <jbel...@gmail.com> wrote:
>>
>> From Java you should be using Hector instead of messing around with
>> raw Thrift.  There is a version for beta2 at
>> https://github.com/rantav/hector/downloads
>>
>> docs are at
>> http://www.riptano.com/sites/default/files/hector-v2-client-doc.pdf
>>
>> On Fri, Nov 5, 2010 at 6:28 PM, CassUser CassUser <cassu...@gmail.com>
>> wrote:
>> > Hey I'm testing a client on beta2 cassandra version 0.7.
>> >
>> >         TFramedTransport transport = new TFramedTransport(new
>> > TSocket("my.ip", 9160));
>> >         Cassandra.Client client = new Cassandra.Client(new
>> > TBinaryProtocol(transport));
>> >         transport.open();
>> >         System.out.println(client.describe_cluster_name());
>> >
>> > Is giving me the following:
>> >
>> > org.apache.thrift.protocol.TProtocolException: Missing version in
>> > readMessageBegin, old client?
>> >         at
>> >
>> > org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:211)
>> >         at
>> >
>> > org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:2706)
>> >         at
>> >
>> > org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:167)
>> >         at
>> >
>> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> >         at
>> >
>> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> >         at java.lang.Thread.run(Thread.java:662)
>> >
>> > I'm using the cassandra 0.7beta2 code on both client and server.
>> >
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of Riptano, the source for professional Cassandra support
>> http://riptano.com
>
>
Strange your code looks just like mine. Possibly check your
configuration file and make sure you cluster is using framed mode.

package hpcas.c03;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.thrift.protocol.*;
import org.apache.thrift.transport.*;
public class FramedConnWrapper {
    private TTransport transport;
    private TProtocol proto;
    private TSocket socket;
    public FramedConnWrapper(String host, int port) {
        socket = new TSocket(host,port);
        transport = new TFramedTransport(socket);
        proto = new TBinaryProtocol(transport);
    }
    public void open() throws Exception {
        transport.open();
    }
    public void close() throws Exception {
        transport.close();
        socket.close();
    }
    public Cassandra.Client getClient() {
        Cassandra.Client client = new Cassandra.Client(proto);
        return client;
    }
}

Reply via email to