2017-08-18 47 views
0

我正在使用Couchlite 2.0DP13在Android上同步來自服務器的沙發數據庫。我複製的代碼如下所示:Couchbase lite 2.0 DP13 Android-無效版本

 URI uri = null; 
     try { 
      uri = new URI(my_url"); 
     } catch (URISyntaxException e) { 
      e.printStackTrace(); 
     } 
     ReplicatorConfiguration replConfig = new ReplicatorConfiguration(database, uri); 
     replConfig.setAuthenticator(new SessionAuthenticator(sessionInfo.cookieValue, sessionInfo.cookieDate, sessionInfo.cookieName)); 
     replConfig.setContinuous(false); 
     replConfig.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL); 
     replicator = new Replicator(replConfig); 
     replicator.addChangeListener(new ReplicatorChangeListener() { 
      @Override 
      public void changed(Replicator replicator, Replicator.Status status, CouchbaseLiteException error) { 
       Log.d("GABE", "status "+status.getActivityLevel()+" prog total "+status.getProgress().getTotal()+" prog comp "+status.getProgress().getCompleted()+" error "+error); 
       if (error == null && status.getActivityLevel() == Replicator.ActivityLevel.STOPPED && status.getProgress().getTotal() == status.getProgress().getCompleted()) { 
        if (replicatorListener != null) { 
         replicatorListener.onFinished(true); 
        } 
       } else if (error != null) { 
        replicatorListener.onFinished(false); 
       } 
      } 
     }); 
     replicator.start(); 

當運行它,我看到了兩個問題:

1)我們正在無效版本編號

08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 952c282301007265760073657175656e636500223230343937323a3230333734322200040005001f8b080000096e8800ff8451cb8edc2010fc95559fcd0a307e1e9391a2bdcf2917ab0ded0d5a1b2c8cad1945f9f7087b6766a33944e242553faaab7e43670db4d088bcea252a464249a686ba6675af244353229a021bd53790411768831604ab24e64555aa42d68ab4e6249a5a9452963d97648a1a3240adfdea22b4703a9ddf9c4ed09490ced8e59372eb383ee095a005fecaf9a374c65d5ed1fc83069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa241715e32513ea2c659b8b362f5e0b297ea68e350472fa7a6f5997e8a73402aac20c3549ce8a4110538492351521cb73c96555230dbc800c0c8d14c9403be0b8500666a50ee3b1b564bc61b23a73deee2f6d24176dbc9eaf7352f6e6366f3525f81229381cf76c0f2df6208fb4659ea784a6ff9fe47ca4e5f0c307f370630e76c348dd173ed040e9fc7de2e9db77c184aa54d394bc4a962fe4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7525870c2285294939adf4e2dd4b204d768e8908a83f52b2a3751fb73177d0ad537fbbebcfdf000000ffffb93dab3c0f030000 
08-18 11:37:01.681 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6507, trans -> false 
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/C4Socket: C4Socket.callback.completedReceive() socket -> 0x777ee53810, byteCount -> 480 
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: Pull->blips:myurl/_blipsync performNextMessage 
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: BLIP[->blips:myurl/_blipsync] performNextMessage 
08-18 11:37:01.682 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 962c282301007265760073657175656e636500223230343937323a3230333734332200040005001f8b080000096e8800ff8451cb8e9c3010fc95559ff1ca9897cd3513457b9f532ea8b19b8db5602363d08ca2fc7b64d899c96a0e917c71553faaab7e43670db440dae8bee69c19948a9575a59822d4acd29cfa7230a8b1810cba401bb4903385aa965ce180bc1c5453f7c5c00b2259944236283864805afbd54568e1743abf399da029219db1cb27e5d6717cc02b410bfc95f347e98cbbbca2fa82069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa04cf1bc66b96976721da226fabfcb596e267ea584320a7aff79675897e4a23a0a9cc204970560d39b1925030d510b2a2105c341269e015646068a44806da01c78532302b75188fad35e38a0975e6bcdd5fda482eda783d5fe7a4eccd6dde6a4af025527038eed91e5aec411e698b424ac860faff49ce475a0e3f7c300f37e660378cd4fdc3071a289dbf4ffc9eab6f2c2f9b2a975c2a01192ce4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7105328814a624e5b4d28b772f8134d9392622a0fe48c98ed67ddcc6dc41b74efdedae3f7f030000ffffcaa2a8a50f030000 
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: inc->blips:myurl/db/_blipsync performNextMessage 
08-18 11:37:01.682 15333-16019/com.handshake.hsdm W/LiteCore [Sync]: {180} Got invalid revision 
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCoreJNI: [NATIVE] C4Replicator.documentErrorCallback() repl -> 0x0x777ef2a2a0, pulling, received invalid revision 

2)

我們」重新獲取與推送相關的消息,即使我將此設置設置爲只能複製。另外,數據庫中沒有文檔。

08-18 11:37:01.552 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6302, trans -> false 

有沒有人見過這些錯誤?沒有他們,我無法繼續前進。我甚至很樂意去弄清楚它的服務器端數據問題,還是我的代碼或者SDK中的客戶端問題。

+0

您是否使用DP版本的Sync Gateway?另外,DP14不在了,所以你可以試試。 – Hod

回答

0

今天發現,事實證明DB13中有一個突破性的協議更改(甚至超出了2.0版本),需要更新服務器。

0

從您的描述看來,您正在與Couch Db而不是SG/Couchbase服務器通話。你能再確認嗎? 因爲Couchbase Lite 2.0實現了與CouchDB不兼容的新複製協議。

+0

我們正在與Sync Gateway通話。問題是,即使在5.0你需要在正確的構建 - DB13改變了協議,甚至2.0 –

+0

好吧,你可能想編輯你的原始問題,指定「couchbase服務器」,而不是「沙發數據庫」然後 – rajagp