Hi Maria,

The default port for the HTTP API is 8098; unless you changed app.config you
may just need to change the port specified in your code.

Thanks,
Dan

Daniel Reverri
Developer Advocate
Basho Technologies, Inc.
[email protected]


On Wed, Jul 13, 2011 at 10:43 AM, Russell Brown <[email protected]>wrote:

> Hi Maria,
> Is riak running? Can you verify it is running by using curl or wget?
>
>     curl -v -X GET http://localhost:8090/riak
>
> The errors says "connection refused" which tells me Riak is probably not
> running, or not running on the port you've specified (8090.)
>
> If you can get Riak running and verify that you have Riak running (maybe
> try the Fast Track [1] to get started) then try the Java client code again.
>
> Cheers
>
> Russell
>
> [1] Riak Fast Track - http://wiki.basho.com/The-Riak-Fast-Track.html
>
> On 13 Jul 2011, at 17:42, Maria Neise wrote:
>
> Hey,
> I am writing an application with the Java-Api. In my application I try
> to get a connection to Riak using the RiakClient in order to insert
> some data. Before, I downloaded Riak with wget
> http://downloads.basho.com/riak/riak-0.14/riak_0.14.2-1_amd64.deb.
> When I start Riak with
> sudo riak start I always get attempting to restart script through sudo
> -u riak. When I start my application I get an RiakIORuntimeException,
> when trying to store a RiakObject. Here is my code:
>
> public class RiakClient extends DB{
>
> com.basho.riak.client.http.RiakClient riakClient;
>
> public void init() throws DBException {
>
>  try{
>
>  riakClient = new
> com.basho.riak.client.http.RiakClient("http://localhost:8090/riak";);
>
>
>  } catch(Throwable t) {
>  t.printStackTrace();
>  }
> }
>
> public int insert(String table, String key, HashMap<String, String> values)
> {
>
>  try{
>
>  com.basho.riak.client.http.RiakObject myObject = new
> com.basho.riak.client.http.RiakObject(table, key);
>
>  Iterator it = values.entrySet().iterator();
>  while(it.hasNext()){
>
>   Map.Entry<String,String> pair = (Map.Entry<String,String>)it.next();
>   String entryKey = pair.getKey();
>   String entryValue = pair.getValue();
>   myObject.addUsermetaItem(entryKey, entryValue);
>
>  }
>
>  com.basho.riak.client.http.response.StoreResponse storeResponse =
> riakClient.store(myObject);
>
>  if(!storeResponse.isSuccess()){
>   return 1;
>  }
>  } catch(Throwable t) {
>  t.printStackTrace();
>  }
>
>  return 0;
>
> }
>
> I also attached a screenshot from the Exception.
>
> I would be grateful for any advice.
> Cheers,
> Maria
> <connection_refused.jpg>_______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to