问题
I upgraded from Worklight 6.1.0.1 to 6.2 and since then, my app stopped loading JSONStore successfully.
It says it can't find the class StoragePlugin, although the class is actually there in the worklight-android.jar
It is also declared in the config.xml file:
<feature name="StoragePlugin">
<param name="android-package" value="com.worklight.androidgap.plugin.storage.StoragePlugin"/>
</feature>
That's the logcat output when I run it on a android device:
07-01 20:58:48.851: D/NONE(4379): initializing JSONStore...
07-01 20:58:49.671: D/SoftKeyboardDetect(4379): Ignore this event
07-01 20:58:49.765: W/System.err(4379): java.lang.ClassNotFoundException: com.worklight.androidgap.plugin.storage.StoragePlugin
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.classForName(Native Method)
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.forName(Class.java:217)
07-01 20:58:49.765: W/System.err(4379): at java.lang.Class.forName(Class.java:172)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginEntry.getClassByName(PluginEntry.java:117)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginEntry.createPlugin(PluginEntry.java:93)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:278)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.execHelper(PluginManager.java:232)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.PluginManager.exec(PluginManager.java:227)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
07-01 20:58:49.765: W/System.err(4379): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:229)
07-01 20:58:49.765: W/System.err(4379): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:646)
07-01 20:58:49.765: W/System.err(4379): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 20:58:49.765: W/System.err(4379): at android.os.Looper.loop(Looper.java:137)
07-01 20:58:49.765: W/System.err(4379): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-01 20:58:49.765: W/System.err(4379): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 20:58:49.765: W/System.err(4379): at java.lang.reflect.Method.invoke(Method.java:511)
07-01 20:58:49.765: W/System.err(4379): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-01 20:58:49.773: W/System.err(4379): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-01 20:58:49.773: W/System.err(4379): at dalvik.system.NativeStart.main(Native Method)
07-01 20:58:49.773: W/System.err(4379): Caused by: java.lang.NoClassDefFoundError: com/worklight/androidgap/plugin/storage/StoragePlugin
07-01 20:58:49.773: W/System.err(4379): ... 19 more
07-01 20:58:49.773: W/System.err(4379): Caused by: java.lang.ClassNotFoundException: com.worklight.androidgap.plugin.storage.StoragePlugin
07-01 20:58:49.773: W/System.err(4379): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-01 20:58:49.773: W/System.err(4379): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-01 20:58:49.773: W/System.err(4379): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-01 20:58:49.773: W/System.err(4379): ... 19 more
07-01 20:58:49.773: I/System.out(4379): Error adding plugin com.worklight.androidgap.plugin.storage.StoragePlugin.
07-01 20:58:49.781: D/PluginManager(4379): exec() call to unknown plugin: StoragePlugin
07-01 20:58:49.781: D/SoftKeyboardDetect(4379): Ignore this event
07-01 20:58:49.882: D/NONE(4379): JSONStore initialize FAIL
07-01 20:58:49.898: D/NONE(4379): {
07-01 20:58:49.898: D/NONE(4379): "src": "initCollection",
07-01 20:58:49.898: D/NONE(4379): "err": -11,
07-01 20:58:49.898: D/NONE(4379): "msg": "OPERATION_FAILED_ON_SPECIFIC_DOCUMENT",
07-01 20:58:49.898: D/NONE(4379): "col": "categories",
07-01 20:58:49.898: D/NONE(4379): "usr": "jsonstore",
07-01 20:58:49.898: D/NONE(4379): "doc": "Class not found",
07-01 20:58:49.898: D/NONE(4379): "res": {}
07-01 20:58:49.898: D/NONE(4379): }
07-01 20:58:49.937: D/dalvikvm(4379): GC_CONCURRENT freed 356K, 12% free 8356K/9479K, paused 2ms+4ms
07-01 21:00:49.687: D/CordovaActivity(4379): Paused the application!
07-01 21:00:49.687: D/CordovaWebView(4379): Handle the pause
Any hint about what may be causing this?
回答1:
We just verified that this is an actual defect, we will be fixing it. The quick fix is to change com.worklight.androidgap.plugin.storage.StoragePlugin to com.worklight.androidgap.plugin.StoragePlugin (remove the ".storage." part) and it will work again.
来源:https://stackoverflow.com/questions/24519695/ibm-worklight-6-2-error-on-storageplugin