I am new to couch base and I am using couchbaselite-1.4.0 for my JAVAFX application.
When I start the application, after few seconds, I am getting the below warning. And my database is not syncing with remote database anymore.
Dec 11, 2017 12:45:07 PM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Error converting lastSequence: null to long. Using 0
My code is
Logger log = Logger.getLogger(DatabaseConfig.LOCAL_DATABASE);
log.setLevel(Level.ALL);
JavaContext context = new JavaContext();
Manager manager = null;
try {
manager = new Manager(context, Manager.DEFAULT_OPTIONS);
} catch (IOException e) {
e.printStackTrace();
}
try {
if (manager != null) {
database = manager.getDatabase(DatabaseConfig.LOCAL_DATABASE);
// Create replicators to push & pull changes to & from Sync Gateway
URL url = null;
try {
url = new URL(DatabaseConfig.REMOTE_DATABASE);
} catch (MalformedURLException e) {
e.printStackTrace();
}
initSync(url);
//Initiating Views
initViews();
} else {
Check.log(this,"initDatabase","manager is null");
}
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
}
private void initSync(URL url) {
List<String> pullChannels = Arrays.asList(ChannelType.ITEM, ChannelType.BILL, ChannelType.CATEGORY, ChannelType.PURCHASE_BILL);
Check.temp("pullChannels: "+pullChannels);
if (url != null && pullChannels.size() > 0) {
Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator(AppConfig.ADMIN_ID, AppConfig.ADMIN_PASSWORD);
Check.temp("admin details: "+AppConfig.ADMIN_ID+" : "+AppConfig.ADMIN_PASSWORD);
Replication push = database.createPushReplication(url);
Replication pull = database.createPullReplication(url);
pull.setChannels(pullChannels);
push.setContinuous(true);
pull.setContinuous(true);
push.setAuthenticator(authenticator);
pull.setAuthenticator(authenticator);
push.start();
pull.start();
Check.temp("status: "+push.getStatus()+" x "+pull.getStatus());
} else {
Check.log(this,"initSync","url or channels is null");
}
}
Please help me