problem with RiakClient streamBucket method

Russell Brown russell.brown at mac.com
Fri Mar 4 04:16:41 EST 2011


Hi Santosh,
On Fri, 2011-03-04 at 12:46 +0530, santhosh venkat wrote:
> Hi , 
>       streamBucket  method of RiakClient throws this exception when i
> tried using it .
> 
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.json.JSONTokener.end()

> I used it  exactly in the same way as said in github wiki .  
> 
> Later reading the source Code of riak , Later reading the source Code
> of riak , I found that the problem lies in StreamedKeysCollection
> Class of package com.basho.riak.client.response. 

>  while (!tokens.end()) {   // -> Method end() is not defined in
> JSONTokener Class 
>  
>   There is a method named more() defined in JSONTokener Class , I was
> able to successfully retrieve all the keys when i replaced end()
> method with more()  . 
> 
> Please throw some light  if i am using the api's wrongly . 
> 

This looks like a classpath thing. 

Do you have another version of JSON-java on your classpath?

There is an older version of JSON-java available from maven central (eg
json-20090211.jar) in which JSONTokener has the more() method.

The riak-java-client actually bundles a more recent set of JSON-java
classes (from Douglas Crockford's githb repo) with the riak client jar,
this version of JSONTokener has the end() method.

Just to be sure, please can you let me know which version of the
RiakClient you are using? (And just for good measure, Java version?)

Going forward, I'm debating whether to use maven to manage this
dependency, or to stay the way things are. Including the JSON classes in
the jar makes it more standalone, but of course it can lead to exactly
this sort of issue. Opinions appreciated.


> 
> --
> Santhosh  
> 
> 
> 
> 
> 
>  
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com






More information about the riak-users mailing list