Riak Java Client Error

Muhammad Yousaf muhammad.yousaf at live.com
Wed Mar 30 13:55:34 EDT 2011



Hi Russel,
After doing the following steps. I am getting these error and tried to solve it but i cannot 
The project cannot be built until build path errors are resolved	Unbound classpath variable: 'M2_REPO/com/google/protobuf/protobuf-java/2.3.0/protobuf-java-2.3.0.jar' in project 'RiakClient'	RiakClient		Build path	Build Path ProblemUnbound classpath variable: 'M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar' in project 'RiakClient'	RiakClient		Build path	Build Path ProblemUnbound classpath variable: 'M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar' in project 'RiakClient'	RiakClient		Build path	Build Path ProblemUnbound classpath variable: 'M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar' in project 'RiakClient'	RiakClient		Build path	Build Path ProblemUnbound classpath variable: 'M2_REPO/junit/junit/4.4/junit-4.4.jar' in project 'RiakClient'	RiakClient		Build path	Build Path ProblemUnbound classpath variable: 'M2_REPO/org/mockito/mockito-all/1.8.0/mockito-all-1.8.0.jar' in project 'RiakClient'	RiakClient		Build path	Build Path Problem
can you please tell me how can i fix them ?
and form where i can get these following jar files ?
riak-client-0.14.0.jarcommons-codec-1.2.jar commons-httpclient-3.1.jarcommons-logging-1.0.4.jarprotobuf-java-2.3.0.jar


Regards,
Muhammad Yousaf



Subject: Re: Riak Java Client Error
From: russell.brown at me.com
Date: Wed, 30 Mar 2011 14:13:49 +0100
CC: riak-users at lists.basho.com
To: muhammad.yousaf at live.com



Hi Muhammad,The riak java client depends on a couple of external libraries (eg. Apache commons HttpClient, google protobufs). These need to be on your class path when you run your program. The easiest way to do this is to use maven[1]. Using maven means you can simply declare the client as a dependency of your project and maven will take care of downloading the jar (and it's dependent jars). If you are using an IDE (like eclipse) you can then get up and running very quickly indeed.
Quick start:
1. get maven2. run mvn archetype:generate3. edit the pom.xml (that mvn generated) and add the following to dependencies  <---- If you already have a project this is all you need to do.
<dependency>  <groupId>com.basho.riak</groupId>  <artifactId>riak-client</artifactId>  <version>0.14.0</version>  <type>pom</type></dependency>
4. run mvn clean:install5 . [optional] if you have eclipse installed run mvn eclipse:eclipse to generate project and class path files.6. start hacking
Of course, if you don't want to get involved with maven you can just grab the following jars and put them on your class path:
riak-client-0.14.0.jarcommons-codec-1.2.jar commons-httpclient-3.1.jarcommons-logging-1.0.4.jarprotobuf-java-2.3.0.jar
Have a read of the README at https://github.com/basho/riak-java-client/
and post back here if you have any trouble.
Cheers
Russell
[1] http://maven.apache.org/download.html (I recommend 2.2.1)
On 30 Mar 2011, at 13:38, Muhammad Yousaf wrote:Hi,
While playing with riak java client i am getting lots of error 
this is my code 
import com.basho.riak.client.RiakClient;import com.basho.riak.client.RiakObject;import com.basho.riak.client.response.FetchResponse;
public class RiakTest {
    public static void main(String[] args) {
        // connect        RiakClient riak = new RiakClient("http://localhost:8098/riak");
        // create object        RiakObject o = new RiakObject("mybucket", "mykey", "myvalue");
        // store        riak.store(o);      }}

getting errors like 
./com/basho/riak/client/RiakClient.java:20: package org.apache.commons.httpclient does not existimport org.apache.commons.httpclient.HttpClient;                                    ^./com/basho/riak/client/util/ClientHelper.java:21: package org.apache.commons.codec.binary does not existimport org.apache.commons.codec.binary.Base64;                                      ^./com/basho/riak/client/util/ClientHelper.java:22: package org.apache.commons.httpclient does not existimport org.apache.commons.httpclient.HttpClient;                                    ^./com/basho/riak/client/util/ClientHelper.java:23: package org.apache.commons.httpclient does not existimport org.apache.commons.httpclient.HttpMethod;                                    ^./com/basho/riak/client/util/ClientHelper.java:24: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.ByteArrayRequestEntity;                                            ^./com/basho/riak/client/util/ClientHelper.java:25: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.DeleteMethod;                                            ^./com/basho/riak/client/util/ClientHelper.java:26: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.GetMethod;                                            ^./com/basho/riak/client/util/ClientHelper.java:27: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.HeadMethod;                                            ^./com/basho/riak/client/util/ClientHelper.java:28: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.PostMethod;                                            ^./com/basho/riak/client/util/ClientHelper.java:29: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.PutMethod;                                            ^./com/basho/riak/client/util/ClientHelper.java:30: package org.apache.commons.httpclient.methods does not existimport org.apache.commons.httpclient.methods.StringRequestEntity;                                            ^

./com/basho/riak/client/response/DefaultHttpResponse.java:20: package org.apache.commons.httpclient does not existimport org.apache.commons.httpclient.HttpMethod;                                    ^./com/basho/riak/client/response/DefaultHttpResponse.java:36: cannot find symbolsymbol  : class HttpMethodlocation: class com.basho.riak.client.response.DefaultHttpResponse    private HttpMethod httpMethod = null;            ^./com/basho/riak/client/response/DefaultHttpResponse.java:39: cannot find symbolsymbol  : class HttpMethodlocation: class com.basho.riak.client.response.DefaultHttpResponse            InputStream stream, HttpMethod httpMethod) {                                ^./com/basho/riak/client/response/DefaultHttpResponse.java:88: cannot find symbolsymbol  : class HttpMethodlocation: class com.basho.riak.client.response.DefaultHttpResponse    public HttpMethod getHttpMethod() {           ^RiakTest.java:13: cannot find symbolsymbol  : constructor RiakObject(java.lang.String,java.lang.String,java.lang.String)location: class com.basho.riak.client.RiakObject        RiakObject o = new RiakObject("mybucket", "mykey", "myvalue");


Can anyone tell what i am doing wrong ???


Regards,
Muhammad Yousaf

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

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110330/670f9c36/attachment.html>


More information about the riak-users mailing list