问题
Using IBM Worklight version 6.1.0.02-20160314-1430
Implemented AES at adapter with reference to below link. https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/server-side-development/javascript-adapters/using-java-adapters/
Its working fine as expected in Eclipse in my local server. Generated war file and same given deployment for server. From server when I am trying to accessing getting below error response.
Below things are crosschecked.
Collected war file from server, crosschecked for class file and its present in that
Restart of server is taken after war file deployment
I am unable to identify where the bug is.
Error response from Server :
{
"status": 200,
"invocationContext": null,
"errorCode": "PROCEDURE_ERROR",
"errorMsg": "Procedureinvocationerror.EcmaError: TypeError: Cannotcallpropertyencryptinobject[ JavaPackagecom.winjit.EncryptionDecryption ].Itisnotafunction, itis\"object\". (API_Adapter-impl.js#7)",
"invocationResult": {
"isSuccessful": false,
"warnings": [
],
"errors": [
"Ecma Error: TypeError: Cannot call property encrypt in object [JavaPackage com.winjit.EncryptionDecryption]. It is not a function, it is \"object\". (API_Adapter-impl.js#7)"
],
"responseID": "3161",
"info": [
]
}
}
回答1:
Update your JDK to 1.8
Add two Security Policy JAR files at /jre/lib/security
- local_policy.jar
- US_export_policy.jar
回答2:
This error due to because of JDK mismatch of development server (Eclipse) and Server(Web sphere). Server is running on JDK 1.6. I downgraded my Eclipse's Java Version. Steps as follows(on mac).
- Eclipse -> Preferences -> Java -> Compiler
- Select Compiler compliance lever -> 1.6
- Eclipse -> Preferences -> Java ->Installed JREs
- Add JDK 1.6 location (/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home)
- Apply ok
- Rebuild project (Restart server if necessary)
- Give war file deployment to server which is re-generated bin folder
Its working for me now as expected
来源:https://stackoverflow.com/questions/46292702/getting-error-from-ibm-workilght-server-it-is-not-a-function-it-is-object