1
votes

I have created a java adapter but it building it fails while building javascript adapters works.

This is my setup:

  • java version "1.7.0_101"
  • OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
  • OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
  • JAVA_HOME is /usr/lib/jvm/java-7-openjdk-amd64
  • OS: linux x64

I have already tried this workaround.

[Error: 
BUILD FAILED
/opt/ibm/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml:206: Build of the adapter 'xxxxxx' failed. The failure message is: 'Compile failed; see the compiler error output for details.'. The failure may have been caused due to incorrect Java code, incompatible JDK level, JAVA_HOME not pointing to the location of a valid JDK or missing dependencies. Note that the worklight-jee-library.jar must be in the classpath when building Java adapters.
]
Error: Sorry an error has occurred. Please check the stack above for details.
1
Why use OpenJdk? Try with Oracle Java. - Idan Adar
@IdanAdar: Thanks for the help, I already tried with Oracle java (JAVA_HOME = /usr/lib/jvm/java-7-oracle), but faced the same issue - Najeeb P
Where are you building the adapter? Using the CLI or Studio? - Idan Adar
@IdanAdar: I have tried using CLI - Najeeb P
After setting java home to Oracle java ,can you try creating a fresh project and try to build it ( not build the one created earlier). - Vivin K

1 Answers

1
votes

The error message specifies the following possible problems:

  1. Code problem
  2. Java path problem

So, if we suspect that we've placed the Java in the right place and that we're using the correct Java version, then I suggest to look at your Java code.

Create a new Java adapter and make no changes in it, rather simply and only create it and build it. See if it passes the build step. If it does, then you need to go back to your existing Java adapter and see why it fails - possibly due to the first option - some code problem.