TFramedTransport needs to be used with Cassandra 0.7. Buffered transport
was the default for 0.6, but it was changed to framed for 0.7.
- Tyler
On Mon, Nov 8, 2010 at 12:55 PM, David Replogle <
david.replogle@steketeegreiner.com> wrote:
> I'm using Cassandra 0.7beta3 and it's running on localhost:9160 and Python
> works with it just fine. So, I go to run C++ against the system and I get:
>
> TTransportException: No more data to read.
>
> I did the thrift --gen cpp interface/cassandra.thrift in my 0.7beta3 folder
> then included those files in the C++ code, and it builds fine, and runs.
>
> It bombs out on the set_keyspace call... the code is short so I'll paste it
> here (not counting includes and using calls):
>
> ---
>
> const string host("localhost");
> const int port= 9160;
>
> int main()
> {
> try {
> boost::shared_ptr<TSocket> socket(new TSocket(host, port));
> boost::shared_ptr<TTransport> transport(new
> TBufferedTransport(socket));
> boost::shared_ptr<TProtocol> protocol(new
> TBinaryProtocol(transport));
>
> CassandraClient client(protocol);
> transport->open();
>
> string version;
> client.set_keyspace("Crawldata");
> transport->close();
> } catch (apache::thrift::transport::TTransportException &tte) {
> cout << "TTransportException: " << tte.what() << endl;
> }
> return 0;
> }
>
> ---
>
> It throws this same error with a series of other calls. This is probably
> (hopefully) something stupid I'm missing. Do I really need to run the C++
> server component (which seems superfluous since it's not actually my
> Cassandra instance) as detailed here:
> http://wiki.apache.org/thrift/ThriftUsageC%2B%2B
>
> --
> David Replogle | Senior Programmer Analyst
>
> Catalyst SGC
> 44 Grandville Ave SW, Ste. 270, Grand Rapids, MI 49503
> Office: 616.855.5522 x204 | Mobile: 616.293.2788
>
>
|