You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Jain Rahul <ja...@ivycomptech.com> on 2013/02/17 05:41:28 UTC
NPE in running "ClientOnlyExample"
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.
Re: NPE in running "ClientOnlyExample"
Posted by aaron morton <aa...@thelastpickle.com>.
An you can never go wrong relying on the documentation for the python pycassa library, it has some handy tutorials for getting started.
http://pycassa.github.com/pycassa/
cheers
-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand
@aaronmorton
http://www.thelastpickle.com
On 18/02/2013, at 9:51 PM, Abhijit Chanda <ab...@gmail.com> wrote:
> I hope you have already gone through this link https://github.com/zznate/hector-examples. If not will suggest you to go through, and you can also refer http://hector-client.github.com/hector/build/html/documentation.html.
>
>
> Best Regards,
>
>
> On Mon, Feb 18, 2013 at 12:15 AM, Jain Rahul <ja...@ivycomptech.com> wrote:
> 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:edlinuxguru@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.
>
>
>
> --
> Abhijit Chanda
> +91-9748888395
Re: NPE in running "ClientOnlyExample"
Posted by Abhijit Chanda <ab...@gmail.com>.
I hope you have already gone through this link *
https://github.com/zznate/hector-examples*. If not will suggest you to go
through, and you can also refer
http://hector-client.github.com/hector/build/html/documentation.html.
Best Regards,
On Mon, Feb 18, 2013 at 12:15 AM, Jain Rahul <ja...@ivycomptech.com> wrote:
> 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:edlinuxguru@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.
>
--
Abhijit Chanda
+91-9748888395
RE: NPE in running "ClientOnlyExample"
Posted by Jain Rahul <ja...@ivycomptech.com>.
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:edlinuxguru@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.
Re: NPE in running "ClientOnlyExample"
Posted by Edward Capriolo <ed...@gmail.com>.
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.