我是沙发基地的新手,我使用couchbaselite-1.4.0作为我的JAVAFX应用程序。
当我启动应用程序时,几秒钟后,我收到以下警告。我的数据库不再与远程数据库同步。
Dec 11, 2017 12:45:07 PM com.couchbase.lite.util.SystemLogger w
WARNING: Sync: Error converting lastSequence: null to long. Using 0
我的代码是
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");
}
}
请帮助我