我正在尝试连接mLab,但我收到此错误:
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: Caused by: java.lang.VerifyError: com/mongodb/DBPort$SaslAuthenticator
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBPort.authenticate(DBPort.java:387)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBPort.checkAuth(DBPort.java:402)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBTCPConnector.doOperation(DBTCPConnector.java:209)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollectionImpl.sendWriteCommandMessage(DBCollectionImpl.java:508)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollectionImpl.writeWithCommandProtocol(DBCollectionImpl.java:458)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollectionImpl.insertWithCommandProtocol(DBCollectionImpl.java:418)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:188)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollectionImpl.insert(DBCollectionImpl.java:167)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollection.insert(DBCollection.java:93)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollection.insert(DBCollection.java:78)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.mongodb.DBCollection.insert(DBCollection.java:120)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.example.irakl_000.maps.server_pcg.ServerRequest$StorePostAsyncTask.doInBackground(ServerRequest.java:161)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at com.example.irakl_000.maps.server_pcg.ServerRequest$StorePostAsyncTask.doInBackground(ServerRequest.java:71)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-09 21:13:04.966 21557-21576/? E/AndroidRuntime: at java.lang.Thread.run(Thread.java:841)
我遵循mLab的指示,但有些事情是错误的。我这是我的代码:
final BasicDBObject[] seedData = createSeedData();
MongoClientURI uri = new MongoClientURI("mongodb://<user>:<<password>@ds041861.mlab.com:port/db");
MongoClient client = new MongoClient(uri);
DB db = client.getDB(uri.getDatabase());
DBCollection songs = db.getCollection("texts");
songs.insert(seedData);// HERE IS THE ERROR
我正在使用mongo-java-driver-2.13.0-rc0.jar驱动程序。
的图片