(now works in java>8) CXF only works on Java 8 !!! Solving the problem partially.
NOTE: apache-cxf version 3.3.6 solves the problem of java version>8
1. Selecting JDK 8
I have installed both JDK 8 and 9. For now, I use JDK 9, so let's use JDK 8. So let's follow Kapil Bradashar's instructions,.
Let's verify we have both versions of JDK.
/usr/lib/jvm/java-1.8.0-openjdk-amd64 /usr/lib/jvm/java-1.9.0-openjdk-amd64
Now let's switch to JDK 8
sudo update-alternatives --config java
And we have the following answer
There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ---------------------------------------------------------------------------------------- 0 /usr/lib/jvm/java-9-oracle/bin/java 1091 mode automàtic 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 mode manual 2 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1091 mode manual * 3 /usr/lib/jvm/java-9-oracle/bin/java 1091 mode manual Press enter to keep the current choice[*], or type selection number:
AS we can see, by default we are using Oracle JDK 9
Let's type option 1 to select JDK 8 as our choice
2. Getting JDK version 8 in the PATH
Following the instructions of muet , we need to add this code to the ~/.bashrc file :
export JAVA_HOME="$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')"
If we type java -version we get the desired version
openjdk version "1.8.0_162"
OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
But this system may fail, so edit your ~/.bashrc file, and comment the previous line (export JAVA_HOME="$(jrunscript -e ....) and add this code:
#export JAVA_HOME="$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')" JAVA_HOME=/usr/lib/jvm/java-9-oracle/ export JAVA_HOME PATH=$JAVA_HOME:$JAVA_HOME/bin:$PATH export PATH
Now let's try to create the WS scaffolding with Apache CXF as indicated in the previous post.
If we want to use this generated scaffolding with a JDK 9 project, it is interesting to see this post. You can see how to generate an executable project with maven using WS Client.
Comments
Post a Comment