Thanks Edward, My Bad. I was confused as It does seems to create keyspace also, As I understand (although i'm not sure)
List<CfDef> cfDefList = new ArrayList<CfDef>(); CfDef columnFamily = new CfDef(KEYSPACE, COLUMN_FAMILY); cfDefList.add(columnFamily); try { client.system_add_keyspace(new KsDef(KEYSPACE, "org.apache.cassandra.locator.SimpleStrategy", 1, cfDefList)); int magnitude = client.describe_ring(KEYSPACE).size(); Can I request you to please point me to some examples with I can start. I try to see some example from hector but it does seems to be in-line with Cassandra's 1.1 version. Regards, Rahul -----Original Message----- From: Edward Capriolo [mailto:edlinuxg...@gmail.com] Sent: 17 February 2013 21:49 To: user@cassandra.apache.org Subject: Re: NPE in running "ClientOnlyExample" This is a bad example to follow. This is the internal client the Cassandra nodes use to talk to each other (fat client) usually you do not use this unless you want to write some embedded code on the Cassandra server. Typically clients use thrift/native transport. But you are likely getting the error you are seeing because the keyspace or column family is not created yet. On Sat, Feb 16, 2013 at 11:41 PM, Jain Rahul <ja...@ivycomptech.com> wrote: > Hi All, > > > > I am newbie to Cassandra and trying to run an example program > "ClientOnlyExample" taken from > https://raw.github.com/apache/cassandra/cassandra-1.2/examples/client_only/src/ClientOnlyExample.java. > But while executing the program it gives me a null pointer exception. > Can you guys please help me out what I am missing. > > > > I am using Cassandra 1.2.1 version. I have pasted the logs at > http://pastebin.com/pmADWCYe > > > > Exception in thread "main" java.lang.NullPointerException > > at > org.apache.cassandra.db.ColumnFamily.create(ColumnFamily.java:71) > > at > org.apache.cassandra.db.ColumnFamily.create(ColumnFamily.java:66) > > at > org.apache.cassandra.db.ColumnFamily.create(ColumnFamily.java:61) > > at > org.apache.cassandra.db.ColumnFamily.create(ColumnFamily.java:56) > > at org.apache.cassandra.db.RowMutation.add(RowMutation.java:183) > > at org.apache.cassandra.db.RowMutation.add(RowMutation.java:204) > > at ClientOnlyExample.testWriting(ClientOnlyExample.java:78) > > at ClientOnlyExample.main(ClientOnlyExample.java:135) > > > > Regards, > > Rahul > > This email and any attachments are confidential, and may be legally > privileged and protected by copyright. If you are not the intended > recipient dissemination or copying of this email is prohibited. If you > have received this in error, please notify the sender by replying by > email and then delete the email completely from your system. Any views > or opinions are solely those of the sender. This communication is not > intended to form a binding contract unless expressly indicated to the > contrary and properly authorised. > Any actions taken on the basis of this email are at the recipient's > own risk. This email and any attachments are confidential, and may be legally privileged and protected by copyright. If you are not the intended recipient dissemination or copying of this email is prohibited. If you have received this in error, please notify the sender by replying by email and then delete the email completely from your system. Any views or opinions are solely those of the sender. This communication is not intended to form a binding contract unless expressly indicated to the contrary and properly authorised. Any actions taken on the basis of this email are at the recipient's own risk.