简体   繁体   中英

Calling java code from javascript adapters

Facing the below issue when trying to invoke java code from javascript adapters with Mobilefirst 8.0.

Sample code from the below link is used for testing.

https://github.com/MobileFirst-Platform-Developer-Center/Adapters/tree/release80

Project structure

com.ibm.mfp.server.js.adapter.internal.JavascriptManagerImpl E FWLST0904E: Exception was thrown while invoking procedure: subtractTwoIntegers in adapter: UsingJavaInJavaScriptAdapters org.mozilla.javascript.EcmaError: TypeError: [JavaPackage com.sample.customcode.Calculator] is not a function, it is object. (UsingJavaInJavaScriptAdapters-impl.js#24) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3951) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3929) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3962) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3981) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:4036) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:4024) at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2502)

This normally happens when your server is running a version of Java that is different from the one with which the adapter was built.For example, MFP server is running on JDK 1.7, while the adapter has been built using JDK 1.8.

Ensure your server is running the same version of Java that is used to build the adapters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM