Search code examples
javaibm-mobilefirstworklight-adapters

Worklight Java-based HTTP adapter deployment


So I have this error when invoking HTTP adapter (from worklight 6.2) deployed on WebSphere Application Server v8.0.0.8 :

TypeError: Cannot call property getData in object [JavaPackage     com.image.Encoder]. It is not a function, it is "object". (ImageAdapter-impl.js#3)
FWLSE0101E: Caused by:  [project worklight]nullorg.mozilla.javascript.EcmaError:     TypeError: Cannot call property getData in object [JavaPackage     com.image.Encoder]. It is not a function, it is "object". (ImageAdapter-    impl.js#3)
        at     org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
    ...

As far as I have looked for info on the internet, it doesn't seem too complicated to deploy Java-based WL adapter. You just compile server/java package into .war classes folder and deploy it to WAS as enterprise application over update or as a new install. Does anyone have any exact guidelines how to deploy java-based adapter so it could be processed correctly?

P.S. Of course I have tried restarting server and adapter DOES work on local environment, although local is liberty server.

P.S.S. I did have same issue on local environment, but it was fixed with adding server/java folder to "Properties > Java Build Path > Source" and sometimes just adding and deleting new class. That last one just rewrites build properties probably, there are plenty of question on this issue actually, but I don't think its related to my issue.


Solution

  • This type of issue typically happens when there is a mismatch between the used Java versions.

    • If you have Java 6 or 7, make sure that your Eclipse preferences also use the same Java level (Eclipse > Preferences > Compiler > Compiler compliance level)
    • And that Eclipse is indeed using the correct version (Eclipse > Preferences > Installed JREs).

    Likewise in the application server (outside Eclipse), it too must use the same Java level that the project was compiled with.

    Related questions: