incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Turner <synfina...@gmail.com>
Subject Re: Problem with libcassandra
Date Tue, 02 Jul 2013 21:40:38 GMT
Have you tried running your code in GDB to find which line is causing the
error?  That would be what I'd do first.

Aaron Turner
http://synfin.net/         Twitter: @synfinatic
https://github.com/synfinatic/tcpreplay - Pcap editing and replay tools for
Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin
"carpe diem quam minimum credula postero"


On Tue, Jul 2, 2013 at 3:18 AM, Shubham Mittal <smsmittal14@gmail.com>wrote:

> I am trying to run below code, but it gives this error. It compiles
> without any errors.  Kindly help me.
> (source of the code :
> http://posulliv.github.io/2011/02/27/libcassandra-sec-indexes/)
>
> terminate called after throwing an instance of
> 'org::apache::cassandra::InvalidRequestException'
>   what():  Default TException.
> Aborted
>
>
> #include <string.h>
> #include <sstream>
> #include <iostream>
> #include <stdlib.h>
> #include <set>
> #include <string>
> #include <stdio.h>
> #include <vector>
>
> #include <libcassandra/cassandra_factory.h>
> #include <libcassandra/cassandra.h>
> #include <libcassandra/column_family_definition.h>
> #include <libcassandra/keyspace.h>
> #include <libcassandra/keyspace_definition.h>
>
> using namespace std;
> using namespace libcassandra;
>
> static string host("127.0.0.1");
> static int port= 9160;
>
> int main()
> {
>
>     CassandraFactory cf(host, port);
>     tr1::shared_ptr<Cassandra> c(cf.create());
>
>     KeyspaceDefinition ks_def;
>     ks_def.setName("demo");
>     c->createKeyspace(ks_def);
>
>     ColumnFamilyDefinition cf_def;
>     cf_def.setName("users");
>     cf_def.setKeyspaceName(ks_def.getName());
>
>     ColumnDefinition name_col;
>     name_col.setName("full_name");
>     name_col.setValidationClass("UTF8Type");
>
>     ColumnDefinition sec_col;
>     sec_col.setName("birth_date");
>     sec_col.setValidationClass("LongType");
>     sec_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
>
>     ColumnDefinition third_col;
>     third_col.setName("state");
>     third_col.setValidationClass("UTF8Type");
>     third_col.setIndexType(org::apache::cassandra::IndexType::KEYS);
>
>     cf_def.addColumnMetadata(name_col);
>     cf_def.addColumnMetadata(sec_col);
>     cf_def.addColumnMetadata(third_col);
>
>     c->setKeyspace(ks_def.getName());
>     c->createColumnFamily(cf_def);
>
>     return 0;
> }
>
>

Mime
View raw message