Couchbase lite replication error


#1

executing following couchbase lite replication code:
Manager manager = new Manager(new JavaContext(“data”), Manager.DEFAULT_OPTIONS);
Manager.enableLogging(“Sync”, Log.VERBOSE);
final Database db = manager.getDatabase(“db_couchbase”);

                        URL url = new URL("http://localhost:4984/sync_gateway/");
                        Replication push = db.createPushReplication(url);
                        Replication pull = db.createPullReplication(url);
                        pull.setContinuous(true);
                        push.setContinuous(true);
                        com.couchbase.lite.auth.Authenticator auth = AuthenticatorFactory.createBasicAuthenticator("GUEST", "");
                        push.setAuthenticator(auth);
                        push.setAuthenticator(auth);
                        pull.setAuthenticator(auth);
                        push.start();
                        pull.start();

exception on running:
Jun 05, 2015 10:33:21 PM com.couchbase.lite.util.SystemLogger e
SEVERE: Sync: RemoteRequest.run() exception: %s
java.lang.ArrayIndexOutOfBoundsException: 1
at com.couchbase.lite.support.RemoteRequest.preemptivelySetAuthCredentials(RemoteRequest.java:281)
at com.couchbase.lite.support.RemoteRequest.run(RemoteRequest.java:96)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


#2

hey @jamiltz can you help out here please.

thanks


#3

Hi @zeeshan_niazi,
You are calling this code line 2 times:

Also the exception says “preemptivelySetAuthCredentials”, move the set auth to be set before pull.setContinuous(true);
push.setContinuous(true);

Please let me know if this helps.