androiddatabaseibm-mobilefirstworklight-studiojsonstore

Worklight app results in PERSISTENT_STORE_FAILURE with JSONStore on my phone


I just tried a small sample worklight app on my phone to test the JSONStore, the init code for which is as follows in my file jsontest.js.

function wlCommonInit(){

var i;

var collectionName = 'exp';

var options = {};

var collections = {};
//Object that defines the 'people' collection
collections[collectionName] = {};
//Object that defines the Search Fields for the 'people' collection

WL.JSONStore.destroy(options);

collections[collectionName].searchFields = {name: 'string', age: 'integer'};

WL.JSONStore.init(collections, options)
.then(function () {
    alert ("JSON Store initialization success!");
})
.fail(function (errorObject) {
    alert (errorObject);
});

I'm getting the error -1: PERSISTENT STORE FAILURE when I run the app on my phone (Galaxy Nexus). The following errorObject is returned.

{
"src": "initCollection",
"err": -1,
"msg": "PERSISTENT_STORE_FAILURE",
"col": "exp"
"usr": "jsonstore",
"doc": {},
"res": {}
}

The app works fine in the Worklight console simulator and in the AVD. My phone has enough storage (600 MB left) to run the app so that shouldn't be a problem.

What am I doing wrong here? Does this have anything to do with the fact that I'm running a custom ROM?

UPDATE: I checked the app on my dad's phone (Sony Xperia Sola) and it worked! Very weird. It doesn't run on my phone, even though all other third-party apps that I have downloaded so far on my phone from the Play Store and other sources all work fine.

So, does Worklight not support custom ROMs?

The custom ROM that I am using is VanirAOSP. I applied a popular custom kernel and I'm using the Dalvik runtime (not ART or anything like that).

I also think that the problem might be because Worklight apps are not fully supported on Android 4.4 KitKat.

Would appreciate it if someone would shed some light on this.


Solution

  • There is an issue that affects the JSONstore when using Worklight 6.0 on Android 4.4, which causes the behavior your are seeing. You can get more information about this here:

    http://www-01.ibm.com/support/docview.wss?uid=swg27040512

    If you are using Worklight Consumer Edition or Worklight Enterprise Edition, you can get a fix for this issue by upgrading to Worklight 6.0.0.2 (a/k/a Worklight 6.0 Fix Pack 2).

    If you are using Worklight Developer Edition, you should be able to use the Eclipse "Check for Updates" function to upgrade your Worklight 6.0 Developer Edition installation to Fix Pack 2.

    Note that after applying the fix, you must remove the JSONstore feature from your application, and then add it back again; this is described in the APAR document that you can access from the page I've linked above.