Getting Error from IBM Workilght Server [It is not a function, it is \“object\”.]

核能气质少年 提交于 2019-12-13 03:30:44

问题


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.

  1. Collected war file from server, crosschecked for class file and its present in that

  2. 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

  1. local_policy.jar
  2. 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).

  1. Eclipse -> Preferences -> Java -> Compiler
  2. Select Compiler compliance lever -> 1.6
  3. Eclipse -> Preferences -> Java ->Installed JREs
  4. Add JDK 1.6 location (/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home)
  5. Apply ok
  6. Rebuild project (Restart server if necessary)
  7. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!