Problem with Ektorp and android

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);

1 Answer

« Back to question.

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-replica...

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/Grocery...