0
votes

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.

1
Worklight 6.2 does not provide "Java adapters". There are only JavaScript adapters that are able to use Java code. Please be precise in your wording so to not confuse the question. Have you read the tutorial on using Java in JavaScript adapters? developer.ibm.com/mobilefirstplatform/documentation/… - Idan Adar
I never said Java adapter, I said "Java-based HTTP adapter" =] thats exactly how it is called in IBM developer works tutorial. - Medardas
Whichever doc you've read contains errors then. In 6.2 no adapter is Java-based. - Idan Adar
Also, there is no such thing as "Worklight Application Server v8.0.0.8". Maybe you mean websphere? - Idan Adar
Step 4 on: goo.gl/WRdcwd And about WAS, you're right actually, its websphere application server - Medardas

1 Answers

1
votes

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: