Problem with Ektorp and android


#1

Hello,

I try to use ektorp client for replication in android and I have an error :
org.ektorp.DocumentNotFoundException: nothing found on db path: /_replicate, Response body: {“error”:“not_found”,“reason”:“unknown URL”}

I installed a gateway and a CouchBase server.
I access to the url /sync_gateway, but the client try to reach /sync_gateway/_replicate.
What’s this ??? and what I have to do to make it work ???

Thank you by advance
Best regards

My code :
// start Ektorp adapter

  		  HttpClient httpClient = new AndroidHttpClient.Builder()
  		    .host("XXX")
  			.username("XXX")
  			.password("XXX")
  			.port(4984)
  			.build();
  		  
  		  CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);

  		  // create a local database
  		  CouchDbConnector dbConnector = new StdCouchDbConnector("sync_gateway", dbInstance);
  		  
  		  // pull this database to the test replication server
  		  ReplicationCommand pullCommand = new ReplicationCommand.Builder()
  		      .source("sync_gateway")
  		      .target("http://XXXX:4984/sync_gateway")
  		      .continuous(true)
  		      .build();

  		  ReplicationStatus status = dbInstance.replicate(pullCommand);

#2

It looks like you are creating an HTTP Client pointed at the Sync Gateway. What you really want to do is point it at the HTTP endpoint for Couchbase Lite Android.

This example might help with your current code: http://docs.couchbase.com/couchbase-lite/cbl-android/#creating-a-replication

Or if you are just getting started, you might want to skip Ektorp all together and talk to our Native Java API. (It will be available in the beta2 of Couchbase Lite Android, due out soon.)

The docs are still being updated but take a look at this application for an example: https://github.com/couchbaselabs/GrocerySync-Android/blob/master/GrocerySync-Android/src/main/java/com/couchbase/grocerysync/MainActivity.java#L132


#3

Thanks for reply

What is the endpoint ???
Could you explain me please ?

I saw the example : http://docs.couchbase.com/couchbase-lite/cbl-android/#creating-a-replication
It’s approximatively what I did, I justed had to adapt it with the latest version of ektorp, cos It does not work…

I saw too the grocerysync example, but It doesnt help me, it doesn’t work like all the other examples I saw in Ektorp and couchbase website, not the same libraries or versions, too complicated…

Thanks