You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Mark Vigeant <ma...@riskmetrics.com> on 2009/11/13 17:51:29 UTC

java API?

Hey-

I'm completely new to Cassandra and I think the wiki and documentation are really well done. Now I'm trying to construct an application to upload data to upload data to my cluster, but I'm having a tough time figuring out the Java API. The client example on the website is a good start, but for some reason the classes Client, ColumnPath, and SlicePredicate are throwing me errors.  I have Cassandra 0.4.2 and I'm developing the application in eclipse on a different machine. I have the thrift library as well as all the Cassandra classes included in the folder /build/classes/org/apache/Cassandra in my build path.

Is the code out of date or am I? Is there a .jar file that I can install to put in my build path? Are there any more examples of ways to build applications in Java for Cassandra? Thank you very much for your time and help!

Mark Vigeant
RiskMetrics Group, Inc.


This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.

RE: java API?

Posted by Mark Vigeant <ma...@riskmetrics.com>.
Thank you so much Robin! That helps a ton. Awesome.

-----Original Message-----
From: Coe, Robin [mailto:robin.coe@bluecoat.com]
Sent: Saturday, November 14, 2009 8:44 AM
To: cassandra-user@incubator.apache.org
Subject: RE: java API?

Hi Mark,

You need to build the project with ant, then add the generated class files to your build path.  Conversely, you can add the pre-built jar but then you'll end up with namespace collisions with the source in your IDE.  Eclipse *should* use the source first, as long as you don't reorder the libraries, so including the jar should be fine.  However, it's better to use the generated class files from the same source tree.

Robin.


-----Original Message-----
From: Mark Vigeant [mailto:mark.vigeant@riskmetrics.com]
Sent: Fri 13/11/2009 09:03
To: cassandra-user@incubator.apache.org
Subject: RE: java API?

Sorry,

The imports aren't being resolved, yet I have the class files attached.

For instance in the line:
Client client = new Client(proto);
It says to import service.apache.Cassandra.Client, which I do but then there is an error on the import saying it cannot be resolved. This could be because I'm not attaching the right things to the build path, but I don't know what exactly TO attach.

Also, in the line
SlicePredicate predicate = new SlicePredicate(null, new SliceRange(new byte[0], new byte[0], false, 10));
There is a constructor error, stating that SlicePredicate either takes another SlicePredicate or nothing at all to be constructed.

Thanks

-----Original Message-----
From: Michael Greene [mailto:michael.greene@gmail.com]
Sent: Friday, November 13, 2009 11:54 AM
To: cassandra-user@incubator.apache.org
Subject: Re: java API?

It would be helpful to know the specific errors you're experiencing.

Michael

On Fri, Nov 13, 2009 at 10:51 AM, Mark Vigeant
<ma...@riskmetrics.com> wrote:
> I'm completely new to Cassandra and I think the wiki and documentation are
> really well done. Now I'm trying to construct an application to upload data
> to upload data to my cluster, but I'm having a tough time figuring out the
> Java API. The client example on the website is a good start, but for some
> reason the classes Client, ColumnPath, and SlicePredicate are throwing me
> errors.  I have Cassandra 0.4.2 and I'm developing the application in
> eclipse on a different machine. I have the thrift library as well as all the
> Cassandra classes included in the folder /build/classes/org/apache/Cassandra
> in my build path.

This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.


This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.

RE: java API?

Posted by "Coe, Robin" <ro...@bluecoat.com>.
Hi Mark,

You need to build the project with ant, then add the generated class files to your build path.  Conversely, you can add the pre-built jar but then you'll end up with namespace collisions with the source in your IDE.  Eclipse *should* use the source first, as long as you don't reorder the libraries, so including the jar should be fine.  However, it's better to use the generated class files from the same source tree.

Robin.


-----Original Message-----
From: Mark Vigeant [mailto:mark.vigeant@riskmetrics.com]
Sent: Fri 13/11/2009 09:03
To: cassandra-user@incubator.apache.org
Subject: RE: java API?
 
Sorry,

The imports aren't being resolved, yet I have the class files attached.

For instance in the line:
Client client = new Client(proto);
It says to import service.apache.Cassandra.Client, which I do but then there is an error on the import saying it cannot be resolved. This could be because I'm not attaching the right things to the build path, but I don't know what exactly TO attach.

Also, in the line
SlicePredicate predicate = new SlicePredicate(null, new SliceRange(new byte[0], new byte[0], false, 10));
There is a constructor error, stating that SlicePredicate either takes another SlicePredicate or nothing at all to be constructed.

Thanks

-----Original Message-----
From: Michael Greene [mailto:michael.greene@gmail.com]
Sent: Friday, November 13, 2009 11:54 AM
To: cassandra-user@incubator.apache.org
Subject: Re: java API?

It would be helpful to know the specific errors you're experiencing.

Michael

On Fri, Nov 13, 2009 at 10:51 AM, Mark Vigeant
<ma...@riskmetrics.com> wrote:
> I'm completely new to Cassandra and I think the wiki and documentation are
> really well done. Now I'm trying to construct an application to upload data
> to upload data to my cluster, but I'm having a tough time figuring out the
> Java API. The client example on the website is a good start, but for some
> reason the classes Client, ColumnPath, and SlicePredicate are throwing me
> errors.  I have Cassandra 0.4.2 and I'm developing the application in
> eclipse on a different machine. I have the thrift library as well as all the
> Cassandra classes included in the folder /build/classes/org/apache/Cassandra
> in my build path.

This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.


Re: java API?

Posted by Richard grossman <ri...@gmail.com>.
You need to add to your classpath all the lib included into the lib
directory of cassandra.
It seems that you miss The Thrifth jar files then you can't find dependency
like TTransport

On Fri, Nov 13, 2009 at 7:03 PM, Mark Vigeant
<ma...@riskmetrics.com>wrote:

> Sorry,
>
> The imports aren't being resolved, yet I have the class files attached.
>
> For instance in the line:
> Client client = new Client(proto);
> It says to import service.apache.Cassandra.Client, which I do but then
> there is an error on the import saying it cannot be resolved. This could be
> because I'm not attaching the right things to the build path, but I don't
> know what exactly TO attach.
>
> Also, in the line
> SlicePredicate predicate = new SlicePredicate(null, new SliceRange(new
> byte[0], new byte[0], false, 10));
> There is a constructor error, stating that SlicePredicate either takes
> another SlicePredicate or nothing at all to be constructed.
>
> Thanks
>
> -----Original Message-----
> From: Michael Greene [mailto:michael.greene@gmail.com]
> Sent: Friday, November 13, 2009 11:54 AM
> To: cassandra-user@incubator.apache.org
> Subject: Re: java API?
>
> It would be helpful to know the specific errors you're experiencing.
>
> Michael
>
> On Fri, Nov 13, 2009 at 10:51 AM, Mark Vigeant
> <ma...@riskmetrics.com> wrote:
> > I'm completely new to Cassandra and I think the wiki and documentation
> are
> > really well done. Now I'm trying to construct an application to upload
> data
> > to upload data to my cluster, but I'm having a tough time figuring out
> the
> > Java API. The client example on the website is a good start, but for some
> > reason the classes Client, ColumnPath, and SlicePredicate are throwing me
> > errors.  I have Cassandra 0.4.2 and I'm developing the application in
> > eclipse on a different machine. I have the thrift library as well as all
> the
> > Cassandra classes included in the folder
> /build/classes/org/apache/Cassandra
> > in my build path.
>
> This email message and any attachments are for the sole use of the intended
> recipients and may contain proprietary and/or confidential information which
> may be privileged or otherwise protected from disclosure. Any unauthorized
> review, use, disclosure or distribution is prohibited. If you are not an
> intended recipient, please contact the sender by reply email and destroy the
> original message and any copies of the message as well as any attachments to
> the original message.
>

RE: java API?

Posted by Mark Vigeant <ma...@riskmetrics.com>.
Sorry,

The imports aren't being resolved, yet I have the class files attached.

For instance in the line:
Client client = new Client(proto);
It says to import service.apache.Cassandra.Client, which I do but then there is an error on the import saying it cannot be resolved. This could be because I'm not attaching the right things to the build path, but I don't know what exactly TO attach.

Also, in the line
SlicePredicate predicate = new SlicePredicate(null, new SliceRange(new byte[0], new byte[0], false, 10));
There is a constructor error, stating that SlicePredicate either takes another SlicePredicate or nothing at all to be constructed.

Thanks

-----Original Message-----
From: Michael Greene [mailto:michael.greene@gmail.com]
Sent: Friday, November 13, 2009 11:54 AM
To: cassandra-user@incubator.apache.org
Subject: Re: java API?

It would be helpful to know the specific errors you're experiencing.

Michael

On Fri, Nov 13, 2009 at 10:51 AM, Mark Vigeant
<ma...@riskmetrics.com> wrote:
> I'm completely new to Cassandra and I think the wiki and documentation are
> really well done. Now I'm trying to construct an application to upload data
> to upload data to my cluster, but I'm having a tough time figuring out the
> Java API. The client example on the website is a good start, but for some
> reason the classes Client, ColumnPath, and SlicePredicate are throwing me
> errors.  I have Cassandra 0.4.2 and I'm developing the application in
> eclipse on a different machine. I have the thrift library as well as all the
> Cassandra classes included in the folder /build/classes/org/apache/Cassandra
> in my build path.

This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.

Re: java API?

Posted by Michael Greene <mi...@gmail.com>.
It would be helpful to know the specific errors you're experiencing.

Michael

On Fri, Nov 13, 2009 at 10:51 AM, Mark Vigeant
<ma...@riskmetrics.com> wrote:
> I’m completely new to Cassandra and I think the wiki and documentation are
> really well done. Now I’m trying to construct an application to upload data
> to upload data to my cluster, but I’m having a tough time figuring out the
> Java API. The client example on the website is a good start, but for some
> reason the classes Client, ColumnPath, and SlicePredicate are throwing me
> errors.  I have Cassandra 0.4.2 and I’m developing the application in
> eclipse on a different machine. I have the thrift library as well as all the
> Cassandra classes included in the folder /build/classes/org/apache/Cassandra
> in my build path.