Re: riak-users Digest, Vol 87, Issue 16

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: riak-users Digest, Vol 87, Issue 16

Pratik Kulkarni-2

I added the joda time jar . Then it throws some time xxx jar and keeps on throwing this. The problem with maven is i am using ant to build my project

Thanks!


On Oct 30, 2016 9:00 AM, <[hidden email]> wrote:
Send riak-users mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of riak-users digest..."


Today's Topics:

   1. Riak Java client API (Pratik Kulkarni)
   2. Re: Riak Java client API (AJAX DoneBy Jack)


----------------------------------------------------------------------

Message: 1
Date: Fri, 28 Oct 2016 11:47:00 -0700
From: Pratik Kulkarni <[hidden email]>
To: [hidden email]
Subject: Riak Java client API
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

Hi All,

I am working on a distributed file storage system using the Java Netty framework. For this purpose i have Raik KV as an in memory  storage solution.
Following jar dependencies are present in my build path :

jackson-all-1.8.5.jar
netty-all-4.0.15.Final.jar
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
protobuf-java-2.6.1.jar
json-20160212.jar
riak-client-2.0.5.jar

When i try initiate connection with the riak node. The connection attempt is successful but when i try to store the object in Riak KV. I keep getting the following NoClassDefFoundError. I am not sure why these errors arrive though i have included all the jars. Do we require apart from riak-client X.X jar any more dependencies. As per the terminal output I tried to add the dependencies by downloading the jars. But it just keeps giving me new dependencies error every time.  Kindly help ?

Please see the riak client code in java to store the file object


package gash.router.inmemory;

import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.api.commands.kv.DeleteValue;
import com.basho.riak.client.api.commands.kv.FetchValue;
import com.basho.riak.client.api.commands.kv.StoreValue;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.RiakNode;
import com.basho.riak.client.core.query.Location;
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.core.query.RiakObject;
import com.basho.riak.client.core.util.BinaryValue;

import java.net.UnknownHostException;

public class RiakClientHandler {

        private static RiakCluster setUpCluster() throws UnknownHostException{
                // This example will use only one node listening on localhost:8098--default config

                RiakNode node = new RiakNode.Builder()
                .withRemoteAddress("127.0.0.1")
                .withRemotePort(8098)
                .build();
     // This cluster object takes our one node as an argument
        RiakCluster cluster = new RiakCluster.Builder(node)
                .build();

        // The cluster must be started to work, otherwise you will see errors
        cluster.start();

        return cluster;
        }

        private static class RiakFile{

                public String filename;
                public byte[] byteData;
        }

        public static void saveFile(String filename,byte[] byteData)
        {
        try{
            System.out.println("Inside Riak handler");
            RiakCluster cluster = setUpCluster();
            RiakClient client = new RiakClient(cluster);
            RiakFile newFile = createRiakFile(filename, byteData);
            System.out.println("Riak file created");
            Namespace fileBucket = new Namespace("files");
            Location fileLocation = new Location(fileBucket, filename);
            StoreValue storeFile = new StoreValue.Builder(newFile).withLocation(fileLocation).build();
            client.execute(storeFile);
            System.out.println("File saved to riak ");
            cluster.shutdown();
                }
                catch(Exception e){
                        e.printStackTrace();
                }
        }

        private static RiakFile createRiakFile(String filename, byte[] byteData)
        {
                RiakFile file=new RiakFile();
                file.filename=filename;
                file.byteData=byteData;
                return file;

        }




}


The terminal Output error:




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.png>

------------------------------

Message: 2
Date: Sat, 29 Oct 2016 13:45:16 -0400
From: AJAX DoneBy Jack <[hidden email]>
To: Pratik Kulkarni <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Subject: Re: Riak Java client API
Message-ID:
        <[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi Pratik,

>From exception msg you are missing joda time jar, download one and put in
your classpath.
If you use maven it will download the dependency for you automatically.

Hope this help.
Ajax

On Friday, 28 October 2016, Pratik Kulkarni <[hidden email]> wrote:

> Hi All,
>
> I am working on a distributed file storage system using the Java Netty
> framework. For this purpose i have Raik KV as an in memory  storage
> solution.
> Following jar dependencies are present in my build path :
>
> jackson-all-1.8.5.jar
> netty-all-4.0.15.Final.jar
> slf4j-api-1.7.2.jar
> slf4j-simple-1.7.2.jar
> protobuf-java-2.6.1.jar
> json-20160212.jar
> riak-client-2.0.5.jar
>
> When i try initiate connection with the riak node. The connection attempt
> is successful but when i try to store the object in *Riak KV.* I keep
> getting the following NoClassDefFoundError. I am not sure why these errors
> arrive though i have included all the jars. Do we require apart from*
> riak-client X.X jar* any more dependencies. As per the terminal output I
> tried to add the dependencies by downloading the jars. But it just keeps
> giving me new dependencies error every time.  Kindly help ?
>
> *Please see the riak client code in java to store the file object *
>
>
> package gash.router.inmemory;
>
> import com.basho.riak.client.api.RiakClient;
> import com.basho.riak.client.api.commands.kv.DeleteValue;
> import com.basho.riak.client.api.commands.kv.FetchValue;
> import com.basho.riak.client.api.commands.kv.StoreValue;
> import com.basho.riak.client.core.RiakCluster;
> import com.basho.riak.client.core.RiakNode;
> import com.basho.riak.client.core.query.Location;
> import com.basho.riak.client.core.query.Namespace;
> import com.basho.riak.client.core.query.RiakObject;
> import com.basho.riak.client.core.util.BinaryValue;
>
> import java.net.UnknownHostException;
>
> public class RiakClientHandler {
> private static RiakCluster setUpCluster() throws UnknownHostException{
> // This example will use only one node listening on
> localhost:8098--default config
>
> RiakNode node = new RiakNode.Builder()
>                 .withRemoteAddress("127.0.0.1")
>                 .withRemotePort(8098)
>                 .build();
>      // This cluster object takes our one node as an argument
>         RiakCluster cluster = new RiakCluster.Builder(node)
>                 .build();
>
>         // The cluster must be started to work, otherwise you will see
> errors
>         cluster.start();
>
>         return cluster;
> }
> private static class RiakFile{
> public String filename;
> public byte[] byteData;
> }
> public static void saveFile(String filename,byte[] byteData)
> {
> try{
>     System.out.println("Inside Riak handler");
>     RiakCluster cluster = setUpCluster();
>             RiakClient client = new RiakClient(cluster);
>             RiakFile newFile = createRiakFile(filename, byteData);
>             System.out.println("Riak file created");
>             Namespace fileBucket = new Namespace("files");
>             Location fileLocation = new Location(fileBucket, filename);
>             StoreValue storeFile = new StoreValue.Builder(newFile).
> withLocation(fileLocation).build();
>             client.execute(storeFile);
>             System.out.println("File saved to riak ");
>             cluster.shutdown();
> }
> catch(Exception e){
> e.printStackTrace();
> }
> }
> private static RiakFile createRiakFile(String filename, byte[] byteData)
> {
> RiakFile file=new RiakFile();
> file.filename=filename;
> file.byteData=byteData;
> return file;
> }
>
> }
>
>
> *The terminal Output error:*
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.png>

------------------------------

Subject: Digest Footer

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


------------------------------

End of riak-users Digest, Vol 87, Issue 16
******************************************

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: riak-users Digest, Vol 87, Issue 16

Alex Moore
Hi Pratik,

You should try our All-In-One / Uber jar: http://riak-java-client.s3.amazonaws.com/index.html

It will contain all the dependencies that the Riak Java Client needs to operate.

Thanks,
Alex

On Oct 30, 2016, at 1:19 PM, Pratik Kulkarni <[hidden email]> wrote:

I added the joda time jar . Then it throws some time xxx jar and keeps on throwing this. The problem with maven is i am using ant to build my project

Thanks!


On Oct 30, 2016 9:00 AM, <[hidden email]> wrote:
Send riak-users mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of riak-users digest..."


Today's Topics:

   1. Riak Java client API (Pratik Kulkarni)
   2. Re: Riak Java client API (AJAX DoneBy Jack)


----------------------------------------------------------------------

Message: 1
Date: Fri, 28 Oct 2016 11:47:00 -0700
From: Pratik Kulkarni <[hidden email]>
To: [hidden email]
Subject: Riak Java client API
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

Hi All,

I am working on a distributed file storage system using the Java Netty framework. For this purpose i have Raik KV as an in memory  storage solution.
Following jar dependencies are present in my build path :

jackson-all-1.8.5.jar
netty-all-4.0.15.Final.jar
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
protobuf-java-2.6.1.jar
json-20160212.jar
riak-client-2.0.5.jar

When i try initiate connection with the riak node. The connection attempt is successful but when i try to store the object in Riak KV. I keep getting the following NoClassDefFoundError. I am not sure why these errors arrive though i have included all the jars. Do we require apart from riak-client X.X jar any more dependencies. As per the terminal output I tried to add the dependencies by downloading the jars. But it just keeps giving me new dependencies error every time.  Kindly help ?

Please see the riak client code in java to store the file object


package gash.router.inmemory;

import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.api.commands.kv.DeleteValue;
import com.basho.riak.client.api.commands.kv.FetchValue;
import com.basho.riak.client.api.commands.kv.StoreValue;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.RiakNode;
import com.basho.riak.client.core.query.Location;
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.core.query.RiakObject;
import com.basho.riak.client.core.util.BinaryValue;

import java.net.UnknownHostException;

public class RiakClientHandler {

        private static RiakCluster setUpCluster() throws UnknownHostException{
                // This example will use only one node listening on localhost:8098--default config

                RiakNode node = new RiakNode.Builder()
                .withRemoteAddress("127.0.0.1")
                .withRemotePort(8098)
                .build();
     // This cluster object takes our one node as an argument
        RiakCluster cluster = new RiakCluster.Builder(node)
                .build();

        // The cluster must be started to work, otherwise you will see errors
        cluster.start();

        return cluster;
        }

        private static class RiakFile{

                public String filename;
                public byte[] byteData;
        }

        public static void saveFile(String filename,byte[] byteData)
        {
        try{
            System.out.println("Inside Riak handler");
            RiakCluster cluster = setUpCluster();
            RiakClient client = new RiakClient(cluster);
            RiakFile newFile = createRiakFile(filename, byteData);
            System.out.println("Riak file created");
            Namespace fileBucket = new Namespace("files");
            Location fileLocation = new Location(fileBucket, filename);
            StoreValue storeFile = new StoreValue.Builder(newFile).withLocation(fileLocation).build();
            client.execute(storeFile);
            System.out.println("File saved to riak ");
            cluster.shutdown();
                }
                catch(Exception e){
                        e.printStackTrace();
                }
        }

        private static RiakFile createRiakFile(String filename, byte[] byteData)
        {
                RiakFile file=new RiakFile();
                file.filename=filename;
                file.byteData=byteData;
                return file;

        }




}


The terminal Output error:




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.png>

------------------------------

Message: 2
Date: Sat, 29 Oct 2016 13:45:16 -0400
From: AJAX DoneBy Jack <[hidden email]>
To: Pratik Kulkarni <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Subject: Re: Riak Java client API
Message-ID:
        <[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi Pratik,

>From exception msg you are missing joda time jar, download one and put in
your classpath.
If you use maven it will download the dependency for you automatically.

Hope this help.
Ajax

On Friday, 28 October 2016, Pratik Kulkarni <[hidden email]> wrote:

> Hi All,
>
> I am working on a distributed file storage system using the Java Netty
> framework. For this purpose i have Raik KV as an in memory  storage
> solution.
> Following jar dependencies are present in my build path :
>
> jackson-all-1.8.5.jar
> netty-all-4.0.15.Final.jar
> slf4j-api-1.7.2.jar
> slf4j-simple-1.7.2.jar
> protobuf-java-2.6.1.jar
> json-20160212.jar
> riak-client-2.0.5.jar
>
> When i try initiate connection with the riak node. The connection attempt
> is successful but when i try to store the object in *Riak KV.* I keep
> getting the following NoClassDefFoundError. I am not sure why these errors
> arrive though i have included all the jars. Do we require apart from*
> riak-client X.X jar* any more dependencies. As per the terminal output I
> tried to add the dependencies by downloading the jars. But it just keeps
> giving me new dependencies error every time.  Kindly help ?
>
> *Please see the riak client code in java to store the file object *
>
>
> package gash.router.inmemory;
>
> import com.basho.riak.client.api.RiakClient;
> import com.basho.riak.client.api.commands.kv.DeleteValue;
> import com.basho.riak.client.api.commands.kv.FetchValue;
> import com.basho.riak.client.api.commands.kv.StoreValue;
> import com.basho.riak.client.core.RiakCluster;
> import com.basho.riak.client.core.RiakNode;
> import com.basho.riak.client.core.query.Location;
> import com.basho.riak.client.core.query.Namespace;
> import com.basho.riak.client.core.query.RiakObject;
> import com.basho.riak.client.core.util.BinaryValue;
>
> import java.net.UnknownHostException;
>
> public class RiakClientHandler {
> private static RiakCluster setUpCluster() throws UnknownHostException{
> // This example will use only one node listening on
> localhost:8098--default config
>
> RiakNode node = new RiakNode.Builder()
>                 .withRemoteAddress("127.0.0.1")
>                 .withRemotePort(8098)
>                 .build();
>      // This cluster object takes our one node as an argument
>         RiakCluster cluster = new RiakCluster.Builder(node)
>                 .build();
>
>         // The cluster must be started to work, otherwise you will see
> errors
>         cluster.start();
>
>         return cluster;
> }
> private static class RiakFile{
> public String filename;
> public byte[] byteData;
> }
> public static void saveFile(String filename,byte[] byteData)
> {
> try{
>     System.out.println("Inside Riak handler");
>     RiakCluster cluster = setUpCluster();
>             RiakClient client = new RiakClient(cluster);
>             RiakFile newFile = createRiakFile(filename, byteData);
>             System.out.println("Riak file created");
>             Namespace fileBucket = new Namespace("files");
>             Location fileLocation = new Location(fileBucket, filename);
>             StoreValue storeFile = new StoreValue.Builder(newFile).
> withLocation(fileLocation).build();
>             client.execute(storeFile);
>             System.out.println("File saved to riak ");
>             cluster.shutdown();
> }
> catch(Exception e){
> e.printStackTrace();
> }
> }
> private static RiakFile createRiakFile(String filename, byte[] byteData)
> {
> RiakFile file=new RiakFile();
> file.filename=filename;
> file.byteData=byteData;
> return file;
> }
>
> }
>
>
> *The terminal Output error:*
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.png>

------------------------------

Subject: Digest Footer

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


------------------------------

End of riak-users Digest, Vol 87, Issue 16
******************************************
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: riak-users Digest, Vol 87, Issue 16

Pratik Kulkarni-2

Hi,

Thank-you Alex .The all in one riak client jar for Java  works very well

Best!
Pratik


On Oct 30, 2016 9:22 PM, "Alex Moore" <[hidden email]> wrote:
Hi Pratik,

You should try our All-In-One / Uber jar: http://riak-java-client.s3.amazonaws.com/index.html

It will contain all the dependencies that the Riak Java Client needs to operate.

Thanks,
Alex

On Oct 30, 2016, at 1:19 PM, Pratik Kulkarni <[hidden email]> wrote:

I added the joda time jar . Then it throws some time xxx jar and keeps on throwing this. The problem with maven is i am using ant to build my project

Thanks!


On Oct 30, 2016 9:00 AM, <[hidden email]> wrote:
Send riak-users mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of riak-users digest..."


Today's Topics:

   1. Riak Java client API (Pratik Kulkarni)
   2. Re: Riak Java client API (AJAX DoneBy Jack)


----------------------------------------------------------------------

Message: 1
Date: Fri, 28 Oct 2016 11:47:00 -0700
From: Pratik Kulkarni <[hidden email]>
To: [hidden email]
Subject: Riak Java client API
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="us-ascii"

Hi All,

I am working on a distributed file storage system using the Java Netty framework. For this purpose i have Raik KV as an in memory  storage solution.
Following jar dependencies are present in my build path :

jackson-all-1.8.5.jar
netty-all-4.0.15.Final.jar
slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar
protobuf-java-2.6.1.jar
json-20160212.jar
riak-client-2.0.5.jar

When i try initiate connection with the riak node. The connection attempt is successful but when i try to store the object in Riak KV. I keep getting the following NoClassDefFoundError. I am not sure why these errors arrive though i have included all the jars. Do we require apart from riak-client X.X jar any more dependencies. As per the terminal output I tried to add the dependencies by downloading the jars. But it just keeps giving me new dependencies error every time.  Kindly help ?

Please see the riak client code in java to store the file object


package gash.router.inmemory;

import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.api.commands.kv.DeleteValue;
import com.basho.riak.client.api.commands.kv.FetchValue;
import com.basho.riak.client.api.commands.kv.StoreValue;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.RiakNode;
import com.basho.riak.client.core.query.Location;
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.core.query.RiakObject;
import com.basho.riak.client.core.util.BinaryValue;

import java.net.UnknownHostException;

public class RiakClientHandler {

        private static RiakCluster setUpCluster() throws UnknownHostException{
                // This example will use only one node listening on localhost:8098--default config

                RiakNode node = new RiakNode.Builder()
                .withRemoteAddress("127.0.0.1")
                .withRemotePort(8098)
                .build();
     // This cluster object takes our one node as an argument
        RiakCluster cluster = new RiakCluster.Builder(node)
                .build();

        // The cluster must be started to work, otherwise you will see errors
        cluster.start();

        return cluster;
        }

        private static class RiakFile{

                public String filename;
                public byte[] byteData;
        }

        public static void saveFile(String filename,byte[] byteData)
        {
        try{
            System.out.println("Inside Riak handler");
            RiakCluster cluster = setUpCluster();
            RiakClient client = new RiakClient(cluster);
            RiakFile newFile = createRiakFile(filename, byteData);
            System.out.println("Riak file created");
            Namespace fileBucket = new Namespace("files");
            Location fileLocation = new Location(fileBucket, filename);
            StoreValue storeFile = new StoreValue.Builder(newFile).withLocation(fileLocation).build();
            client.execute(storeFile);
            System.out.println("File saved to riak ");
            cluster.shutdown();
                }
                catch(Exception e){
                        e.printStackTrace();
                }
        }

        private static RiakFile createRiakFile(String filename, byte[] byteData)
        {
                RiakFile file=new RiakFile();
                file.filename=filename;
                file.byteData=byteData;
                return file;

        }




}


The terminal Output error:




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161028/a848f3a3/attachment-0001.png>

------------------------------

Message: 2
Date: Sat, 29 Oct 2016 13:45:16 -0400
From: AJAX DoneBy Jack <[hidden email]>
To: Pratik Kulkarni <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Subject: Re: Riak Java client API
Message-ID:
        <[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi Pratik,

>From exception msg you are missing joda time jar, download one and put in
your classpath.
If you use maven it will download the dependency for you automatically.

Hope this help.
Ajax

On Friday, 28 October 2016, Pratik Kulkarni <[hidden email]> wrote:

> Hi All,
>
> I am working on a distributed file storage system using the Java Netty
> framework. For this purpose i have Raik KV as an in memory  storage
> solution.
> Following jar dependencies are present in my build path :
>
> jackson-all-1.8.5.jar
> netty-all-4.0.15.Final.jar
> slf4j-api-1.7.2.jar
> slf4j-simple-1.7.2.jar
> protobuf-java-2.6.1.jar
> json-20160212.jar
> riak-client-2.0.5.jar
>
> When i try initiate connection with the riak node. The connection attempt
> is successful but when i try to store the object in *Riak KV.* I keep
> getting the following NoClassDefFoundError. I am not sure why these errors
> arrive though i have included all the jars. Do we require apart from*
> riak-client X.X jar* any more dependencies. As per the terminal output I
> tried to add the dependencies by downloading the jars. But it just keeps
> giving me new dependencies error every time.  Kindly help ?
>
> *Please see the riak client code in java to store the file object *
>
>
> package gash.router.inmemory;
>
> import com.basho.riak.client.api.RiakClient;
> import com.basho.riak.client.api.commands.kv.DeleteValue;
> import com.basho.riak.client.api.commands.kv.FetchValue;
> import com.basho.riak.client.api.commands.kv.StoreValue;
> import com.basho.riak.client.core.RiakCluster;
> import com.basho.riak.client.core.RiakNode;
> import com.basho.riak.client.core.query.Location;
> import com.basho.riak.client.core.query.Namespace;
> import com.basho.riak.client.core.query.RiakObject;
> import com.basho.riak.client.core.util.BinaryValue;
>
> import java.net.UnknownHostException;
>
> public class RiakClientHandler {
> private static RiakCluster setUpCluster() throws UnknownHostException{
> // This example will use only one node listening on
> localhost:8098--default config
>
> RiakNode node = new RiakNode.Builder()
>                 .withRemoteAddress("127.0.0.1")
>                 .withRemotePort(8098)
>                 .build();
>      // This cluster object takes our one node as an argument
>         RiakCluster cluster = new RiakCluster.Builder(node)
>                 .build();
>
>         // The cluster must be started to work, otherwise you will see
> errors
>         cluster.start();
>
>         return cluster;
> }
> private static class RiakFile{
> public String filename;
> public byte[] byteData;
> }
> public static void saveFile(String filename,byte[] byteData)
> {
> try{
>     System.out.println("Inside Riak handler");
>     RiakCluster cluster = setUpCluster();
>             RiakClient client = new RiakClient(cluster);
>             RiakFile newFile = createRiakFile(filename, byteData);
>             System.out.println("Riak file created");
>             Namespace fileBucket = new Namespace("files");
>             Location fileLocation = new Location(fileBucket, filename);
>             StoreValue storeFile = new StoreValue.Builder(newFile).
> withLocation(fileLocation).build();
>             client.execute(storeFile);
>             System.out.println("File saved to riak ");
>             cluster.shutdown();
> }
> catch(Exception e){
> e.printStackTrace();
> }
> }
> private static RiakFile createRiakFile(String filename, byte[] byteData)
> {
> RiakFile file=new RiakFile();
> file.filename=filename;
> file.byteData=byteData;
> return file;
> }
>
> }
>
>
> *The terminal Output error:*
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2016-10-28 at 11.29.23 AM.png
Type: image/png
Size: 98161 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20161029/d8ae1df6/attachment-0001.png>

------------------------------

Subject: Digest Footer

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


------------------------------

End of riak-users Digest, Vol 87, Issue 16
******************************************
_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com