在我的 Mac 10.9.2 中,我安装了沙发基础服务器,它正在运行http://127.0.0.1:8091
它有它的默认存储桶,包括 beer-sample
我将同步服务器启动为
./sync_gateway -bucket="beer-sample"
在控制台中记录以下内容
14:00:55.903306 ==== Couchbase Sync Gateway/0.94 ====
14:00:55.979850 Configured Go to use all 2 CPUs; setenv GOMAXPROCS to override this
14:00:55.979985 Configured MaxFileDescriptors (RLIMIT_NOFILE) to 5000
14:00:56.005329 Opening db /beer-sample as bucket "beer-sample", pool "default", server <walrus:>
14:00:56.019242 Opening Walrus database beer-sample on <walrus:>
14:00:56.057276 Using default sync function 'channel(doc.channels)' for database "beer-sample"
14:00:56.057549 Starting profile server on
14:00:56.057680 Starting admin server on 127.0.0.1:4985
14:00:56.090556 Starting server on :4984 ...
在 android 我的复制代码看起来像
Replication pullReplication = database.createPullReplication("http://10.0.2.2:4984");
pullReplication.start();
然后我在模拟器中运行我的 android 应用程序,并在 changeEventListener 中记录了错误
if (!replication.isRunning()){
Log.d(TAG, "Replication is not running due to " + replication.getLastError().getMessage());
Log.d(TAG, "Replication is not running due to " + replication.getLastError().getCause());
Log.d(TAG, "Replication is not running due to " + replication.getLastError().getStackTrace());
Log.d(TAG, "Replication is not running due to " + replication.getLastError().toString());
}
记录的
04-04 14:04:18.402 1622-1644/com.couchbase.replicationsample.replicationsample D/HelloWorld﹕ Replication: Puller[http://10.0.2.2:4984] changed.
04-04 14:04:18.432 1622-1644/com.couchbase.replicationsample.replicationsample D/HelloWorld﹕ Replication is not running due to HTTP/1.1 404 Not Found
04-04 14:04:18.454 1622-1644/com.couchbase.replicationsample.replicationsample D/HelloWorld﹕ Replication is not running due to null
04-04 14:04:18.502 1622-1644/com.couchbase.replicationsample.replicationsample D/HelloWorld﹕ Replication is not running due to [Ljava.lang.StackTraceElement;@414efc88
04-04 14:04:18.502 1622-1644/com.couchbase.replicationsample.replicationsample D/HelloWorld﹕ Replication is not running due to com.couchbase.lite.CouchbaseLiteException: HTTP/1.1 404 Not Found
Note: I am using 10.0.2.2 instead of 127.0.0.1 because i read in forum that's how simulator maps the host machine. But i also tried 127.0.0.1 earlier which also gives the same result.
同时,我在同步网关控制台中看到一个新条目,例如
14:05:13.532393 HTTP: #006: GET /_changes?feed=normal&heartbeat=300000
我试图在浏览器中重复这个查询
> http://127.0.0.1:4984/_changes?feed=normal&heartbeat=300000
这是显示
{"error":"not_found","reason":"unknown URL"}
我在这里做错了什么?我是沙发基地的新手。