Pure Java Couchbase Lite - Sync Gateway not picking up changes


I’ve got a pure Java CBL database running on my Mac and I’m able to add/remove docs from it. I have Sync Gateway running on a VM in the cloud. When I run the code on my Mac to start the sync function, it syncs all documents which is great. However, when I add another document the sync does not detect the change. It just sits at WARNING: Sync: [fireTrigger()] => WAITING_FOR_CHANGES. If I stop the Java process and restart it, the sync runs and sends my document updates to the server but again does not pick up new changes while its running. I have continuous set to true. What am I missing?
Manager manager = new Manager(new JavaContext(), Manager.DEFAULT_OPTIONS); URL sgUrl = new URL(syncGatewayUrl); Authenticator auth = new BasicAuthenticator(username, password); Database db = manager.getDatabase(dbString); Replication push = db.createPushReplication(sgUrl); push.setContinuous(true); push.setAuthenticator(auth); push.start();
Why isn’t it detecting new documents were added while the process is running?

Thank you!


@hideki, do you know what could be an issue here?


Hi @vzdavid,

Your code looks good. As you expected, the push replicator should detect the local database changes and automatically syncs with sync gateway.

What version of Couchbase Lite are you using? How did you get it, compiled from github master branch, or download?

If possible, can you try CBL Java from github master branch? And if it still fails, please fill the ticket, https://github.com/couchbase/couchbase-lite-java-core/issues . Of course, you can file the ticket without trying latest.



It may also be useful to know what version of Sync Gateway you’re using.



Everything was the latest as of the time of posting:
Couchbase Lite 1.0.3
Sync Gateway Community Ed 1.0.3

I did notice in the JavaContext code, the following which is stubbed out:

    public NetworkReachabilityManager getNetworkReachabilityManager() {
        return new FakeNetworkReachabilityManager();

    class FakeNetworkReachabilityManager extends NetworkReachabilityManager {
        public void startListening() {


        public void stopListening() {


Is that used in the sync?


Hi @vzdavid,

Sorry for late reply. I did not get any notification about new comments…

NetworkReachabilityManager is not related with sync. This is for handling network connectivity such as wifi.

CBL Java should automatically detects local database record insertion/update, and it pushes new record/update to sync gateway automatically, as your code uses continuous mode.

If you are still having issue, please file a ticket: https://github.com/couchbase/couchbase-lite-java-core/issues