Worklight 6.1:Android 4.2.2上的JSONStore初始化问题

时间:2014-03-31 18:34:23

标签: android ibm-mobilefirst jsonstore

环境:

Worklight 6.1

三星Tab 3

Android 4.2.2

初始化JSONStore的代码 -

var collections = {};
collections["SampleApp"] = {};
collections["SampleApp"].searchFields = {uName: 'string', uPassword: 'string'};

var options = {};
options.username = "offlineUser";
options.password = "psw12345";
options.localKeyGen = true;
options.clear = false;

WL.JSONStore.init(collections, options)
.then(function () {
    WL.Logger.debug("Successfully initialized JSON Store");
})
.fail(function (errorObject) {
    WL.Logger.debug("Error while initialing JSON Store - " + errorObject);
});

我在初始化JSONStore时遇到异常 -

03-29 14:02:15.735: D/dalvikvm(18569): Trying to load lib /data/data/com.sample.mobile.SampleApp/files/libcrypto.so.1.0.0 0x424a8a20
03-29 14:02:15.740: D/dalvikvm(18569): Added shared lib /data/data/com.sample.mobile.SampleApp/files/libcrypto.so.1.0.0 0x424a8a20
03-29 14:02:15.740: D/dalvikvm(18569): No JNI_OnLoad found in /data/data/com.sample.mobile.SampleApp/files/libcrypto.so.1.0.0 0x424a8a20, skipping init
03-29 14:02:15.785: W/PluginManager(18569): THREAD WARNING: exec() call to StoragePlugin.isKeyGenRequired blocked the main thread for 45ms. Plugin should use CordovaInterface.getThreadPool().
03-29 14:02:15.855: I/dalvikvm(18569): Could not find method org.json.JSONException.<init>, referenced from method com.worklight.androidgap.jsonstore.security.DPKBean.<init>
03-29 14:02:15.855: W/dalvikvm(18569): VFY: unable to resolve direct method 24133: Lorg/json/JSONException;.<init> (Ljava/lang/Throwable;)V
03-29 14:02:15.855: D/dalvikvm(18569): VFY: replacing opcode 0x70 at 0x000d
03-29 14:02:16.830: D/dalvikvm(18569): Trying to load lib /data/app-lib/com.sample.mobile.SampleApp-1/libopenssl_fips.so 0x424a8a20
03-29 14:02:16.830: D/dalvikvm(18569): Added shared lib /data/app-lib/com.sample.mobile.SampleApp-1/libopenssl_fips.so 0x424a8a20
03-29 14:02:16.830: D/dalvikvm(18569): No JNI_OnLoad found in /data/app-lib/com.sample.mobile.SampleApp-1/libopenssl_fips.so 0x424a8a20, skipping init
03-29 14:02:16.830: I/dalvikvm(18569): Could not find method com.google.common.collect.Maps.newHashMap, referenced from method net.sqlcipher.database.SQLiteDatabase.<init>
03-29 14:02:16.830: W/dalvikvm(18569): VFY: unable to resolve static method 762: Lcom/google/common/collect/Maps;.newHashMap ()Ljava/util/HashMap;
03-29 14:02:16.830: D/dalvikvm(18569): VFY: replacing opcode 0x71 at 0x0024
03-29 14:02:16.845: D/dalvikvm(18569): Trying to load lib /data/app-lib/com.sample.mobile.SampleApp-1/libstlport_shared.so 0x424a8a20
03-29 14:02:16.845: D/dalvikvm(18569): Added shared lib /data/app-lib/com.sample.mobile.SampleApp-1/libstlport_shared.so 0x424a8a20
03-29 14:02:16.845: D/dalvikvm(18569): No JNI_OnLoad found in /data/app-lib/com.sample.mobile.SampleApp-1/libstlport_shared.so 0x424a8a20, skipping init
03-29 14:02:16.845: D/dalvikvm(18569): Trying to load lib /data/app-lib/com.sample.mobile.SampleApp-1/libsqlcipher_android.so 0x424a8a20
03-29 14:02:16.850: D/dalvikvm(18569): Added shared lib /data/app-lib/com.sample.mobile.SampleApp-1/libsqlcipher_android.so 0x424a8a20
03-29 14:02:16.850: D/dalvikvm(18569): No JNI_OnLoad found in /data/app-lib/com.sample.mobile.SampleApp-1/libsqlcipher_android.so 0x424a8a20, skipping init
03-29 14:02:16.850: D/dalvikvm(18569): Trying to load lib /data/app-lib/com.sample.mobile.SampleApp-1/libdatabase_sqlcipher.so 0x424a8a20
03-29 14:02:16.850: D/dalvikvm(18569): Added shared lib /data/app-lib/com.sample.mobile.SampleApp-1/libdatabase_sqlcipher.so 0x424a8a20
03-29 14:02:16.850: I/Database(18569): JNI_OnLoad called
03-29 14:02:16.850: I/Database(18569): JNI_OnLoad register methods 
03-29 14:02:16.850: E/jsonstore-core(18569): Error during provision
03-29 14:02:16.850: E/jsonstore-core(18569): java.lang.NoClassDefFoundError: com.google.common.collect.Maps
03-29 14:02:16.850: E/jsonstore-core(18569):    at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:352)
03-29 14:02:16.850: E/jsonstore-core(18569):    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:900)
03-29 14:02:16.850: E/jsonstore-core(18569):    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:947)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.jsonstore.database.DatabaseManager.openDatabaseIfNecessary(DatabaseManager.java:185)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.jsonstore.database.DatabaseManager.checkDatabaseAgainstSchema(DatabaseManager.java:87)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.plugin.storage.ProvisionActionDispatcher.isSchemaMismatched(ProvisionActionDispatcher.java:155)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.plugin.storage.ProvisionActionDispatcher.dispatch(ProvisionActionDispatcher.java:293)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.plugin.storage.BaseActionDispatcher.dispatch(BaseActionDispatcher.java:87)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.plugin.storage.DispatchingPlugin$ActionDispatcherRunnable.run(DispatchingPlugin.java:113)
03-29 14:02:16.850: E/jsonstore-core(18569):    at com.worklight.androidgap.plugin.storage.DispatchingPlugin$SerialExecutor$1.run(DispatchingPlugin.java:147)
03-29 14:02:16.850: E/jsonstore-core(18569):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-29 14:02:16.850: E/jsonstore-core(18569):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-29 14:02:16.850: E/jsonstore-core(18569):    at java.lang.Thread.run(Thread.java:856)
03-29 14:02:16.865: D/SampleApp(18569): Error while initialing JSON Store - {
03-29 14:02:16.865: D/SampleApp(18569):  "src": "initCollection",
03-29 14:02:16.865: D/SampleApp(18569):  "err": -1,
03-29 14:02:16.865: D/SampleApp(18569):  "msg": "PERSISTENT_STORE_FAILURE",
03-29 14:02:16.865: D/SampleApp(18569):  "col": "SampleApp",
03-29 14:02:16.865: D/SampleApp(18569):  "usr": "offlineUser",
03-29 14:02:16.865: D/SampleApp(18569):  "doc": {},
03-29 14:02:16.865: D/SampleApp(18569):  "res": {}
03-29 14:02:16.865: D/SampleApp(18569): }
03-29 14:02:16.865: D/SampleApp(18569): loadServerConnectionDetails
03-29 14:02:16.885: E/SampleApp(18569): [wl.jsonstore] {"src":"initCollection","err":-1,"msg":"PERSISTENT_STORE_FAILURE","col":"SampleApp","usr":"offlineUser","doc":{},"res":{}}

如果我方需要更多数据,请告诉我。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

由于构建机器上缺少guava.jar文件而发生异常 -

/apps/SampleApp/android/native/libs/guava.jar

从Worklight 6.0升级到6.1后生成的

我们已经关注了工作灯文档 - Integrating with source control systems,它没有提及任何关于“libs”文件夹的内容,因此没有签入文件。

现在,build machine接受任何签入并构建APK文件。生成的APK文件不包含“guava.jar”文件,其中包含“com.google.common.collect.Maps”包。因此我们看到了这个问题。

注意:添加更改以使用JSONStore后,我们看到了这个问题。所以它看起来像JSONStore使用这个包。