1
votes

I'm trying to run the Java in Worklight Adapters example from the worklightadapterproject smaple project, but I am facing an error when trying to invoke a procedure:

{
   "errors": [
      "Ecma Error: TypeError: Cannot call property addTwoIntegers in object [JavaPackage com.worklight.customcode.Calculator1]. It is not a function, it is \"object\". (C%3A%5CWorklightLab%5Cworkspace%5CWorklightAdaptersProject%5Cadapters%5CCalculatorAdapter\/CalculatorAdapter-impl.js#9)"
   ],
   "info": [
   ],
   "isSuccessful": false,
   "warnings": [
   ]
}

How do I resolve this?

I tried setting this by using the following configuration which didn't work:

config preferencesconfig preferences 2

1
I'm willing to bet money on your war not being built right. Extract it and try to find the class you're trying to create an instance of, and I bet you it won't be there. - Zarathuztra
I'm willing to bet money as well, see my answer below. ;) - Idan Adar

1 Answers

2
votes

This has been asked before. See the following questions and their solutions.
This is caused by one of two things:

  1. By not using Java compiler level 1.6 and JRE v1.6 (probably)
  2. Due to a missing segment in the .project file (less likely)

Try option #1 - use JRE 1.6 and Java compiler level 1.6.
Follow the instructions in the answer.