We are working with MobileFirst Platform Studio 7.1, installed on top of Eclipse Luna 4.4.2 (I believe Eclipse comes with its own embedded Java compiler - according to the Workspace properties, the "Compiler Compliance Level" is set to 1.7).
When we build our .adapter
file, and then take it apart with unzip and check the version of one of the .class
files within with file myadapter.adapter
, it shows myadapter.adapter: compiled Java class data, version 51.0
, which corresponds to Java Platform 7 (1.7).
However, when we deploy it to our standalone MobileFirst Platform Server, running on top of WAS ND, we get an error, both in the MobileFirst administration console and the WAS SystemOut.log:
[11/3/15 11:56:07:166 UTC] 0000009b StatusMessage E StatusMessage createStatusMessage Preparation to deploy adapter 'MyAdapter' failed.
java.lang.Error: The adapter was built with a later version of Java than is used to run the server.
at com.worklight.adapters.rest.ParentLastClassLoader.defineClass(ParentLastClassLoader.java:274)
at com.worklight.adapters.rest.ParentLastClassLoader.defineClassFromURL(ParentLastClassLoader.java:233)
at com.worklight.adapters.rest.ParentLastClassLoader.internalFindClass(ParentLastClassLoader.java:215)
at com.worklight.adapters.rest.ParentLastClassLoader.loadClass(ParentLastClassLoader.java:128)
The Java level on the server is also 1.7, as shown by java -version
:
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
I don't believe this error is correct, unless there is some subtlety in the way JDK levels are validated (perhaps it's looking at the patch level as well?).
How can we fix this error? Is there a way we can force the JDK in Eclipse to be at a particular level?
Update: We've just tried dropping the JDK compliance level in Eclipse to 1.6, we still have the same problem.