Oracle JDK installation on Yocto build - java

I'm trying to install Oracle JDK on my yocto build as it's needed to build the OpenCV Java API.
This is my configuration file:
MACHINE ??= "intel-corei7-64"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_deb"
SDKMACHINE ?= "x86_64"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
# Modify the following line accoring to your Host Machine setup
# Example: CPU with 6 core 12 threads use the following configuration.
BB_NUMBER_THREADS = '12'
PARALLEL_MAKE = '-j 12'
# Java installation
IMAGE_INSTALL_append += " gtkperf libxslt oracle-jse-jre "
LICENSE_FLAGS_WHITELIST += "oracle_java"
PREFERRED_VERSION_xserver-nodm-init = "1.0"
# OpenCV installation
CORE_IMAGE_EXTRA_INSTALL += "opencv opencv-samples libopencv-core-dev libopencv-highgui-dev libopencv-imgproc-dev libopencv-objdetect-dev libopencv-ml-dev"
bblayers.conf is correctly set. I'm using morty branch for every layer.
For building I simply launch the command:
bitbake core-image-sato
The build end successfully but I end up with the following error on the target machine:
root#intel-corei7-64:~# java -version
-sh: /usr/bin/java: No such file or directory
But
root#intel-corei7-64:/usr/bin# ls -l | grep java
lrwxrwxrwx 1 root root 31 Apr 1 11:40 java -> /usr/share/jre1.8.0_91/bin/java
And looking in said directory
root#intel-corei7-64:/usr/share/jre1.8.0_91/bin# ls -l
total 388
lrwxrwxrwx 1 root root 8 Apr 1 11:40 ControlPanel -> jcontrol
-rwxr-xr-x 1 1001 1001 5080 Apr 1 09:14 java
-rwxr-xr-x 1 1001 1001 103920 Apr 1 09:14 javaws
-rwxr-xr-x 1 1001 1001 6264 Apr 1 2016 jcontrol
-rwxr-xr-x 1 1001 1001 5208 Apr 1 09:14 jjs
-rwxr-xr-x 1 1001 1001 5208 Apr 1 09:14 keytool
-rwxr-xr-x 1 1001 1001 5416 Apr 1 09:14 orbd
-rwxr-xr-x 1 1001 1001 5224 Apr 1 09:14 pack200
-rwxr-xr-x 1 1001 1001 5264 Apr 1 09:14 policytool
-rwxr-xr-x 1 1001 1001 5208 Apr 1 09:14 rmid
-rwxr-xr-x 1 1001 1001 5216 Apr 1 09:14 rmiregistry
-rwxr-xr-x 1 1001 1001 5232 Apr 1 09:14 servertool
-rwxr-xr-x 1 1001 1001 5448 Apr 1 09:14 tnameserv
-rwxr-xr-x 1 1001 1001 200400 Apr 1 09:14 unpack200
Do I need to do something more to correctly build the image? Is there anything wrong with my configuration files? Anybody encountered the same error?

I ran into the same problem, and with some generous help given by Fabio Berton from O.S. Systems, we found out that the problem is related to the fact that /usr/bin/java depends on /lib64/ld-linux-x86-64.so.2.
You can check that by opening a shell inside the target and doing strings /usr/lib/jvm/java-8-oracle/bin/java.
We also found that /lib/ld-linux-x86-64.so.2 is a symbolic link to /lib/ld-2.26.so.
So all you have to do is to create a oracle-jse-jdk_1.7.0.bbappend like this:
FILES_${PN} += "/lib64/ld-linux-x86-64.so.2"
do_install_append() {
install -d ${D}/lib64
cd ${D}/lib64
ln -s ../lib/ld-2.26.so ld-linux-x86-64.so.2
}
Regards,
Bernardo.

I couldn't installe Oracle JDK but I managed to install openjdk-8 and succesfully enable the OpenCV Java API.
I made a guide on how to accomplish this.

Related

install4j support for code signing MacOS console launchers that load dyld libraries via System.loadLibrary

I have an issue with a MacOS folder DMG media file that I created with install4j 8.0.8. If I code sign the package, everything gets signed correctly including my *.dyld files that reside in a lib/ directory. Also, my GUI programs work fine and calls to System.loadLibrary() succeed and load the dyld files correctly. However, my command-line programs that call the same Java code as my GUI programs fail when they get to the System.loadLibrary() call with this message:
java.lang.UnsatisfiedLinkError: jhdf5 (Not found in java.library.path)
at java.base/java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1745)
at java.base/java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1697)
at java.base/java.lang.System.loadLibrary(System.java:591)
But, if I disable code signing when I build the media file for MacOS, which I do by passing disableSigning=true from Ant, both GUI and command-line programs work fine.
So possibly, I'm not understanding if I need to do something extra with the Java VM parameters when running a program from a console launcher versus a GUI launcher on MacOS (I'm running Big Sur). Or is it just not possible to run console launchers in a code signed media file where dyld files are loaded on demand? Maybe due to the fact that console launchers are implemented as scripts on MacOS. The install4j 8 documentation doesn't seem to mention this nuance that I can find.
The directory structure of the installed files looks like this:
Peters-MacBook-Pro-16:CoastWatch Utilities Signed phollema$ ll
total 4224
drwxr-xr-x 10 phollema admin 320 9 Apr 17:25 .
drwxrwxr-x 37 root admin 1184 9 Apr 17:24 ..
drwxr-xr-x 53 phollema admin 1696 9 Apr 17:25 .install4j
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 CoastWatch Utilities Uninstaller.app
drwxr-xr-x 25 phollema admin 800 9 Apr 18:50 bin
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 data
drwxr-xr-x 8 phollema admin 256 9 Apr 17:25 doc
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 extensions
drwxr-xr-x 4 phollema admin 128 9 Apr 17:25 lib
-rw-r--r-- 1 phollema admin 1608406 9 Apr 17:12 src.zip
Peters-MacBook-Pro-16:CoastWatch Utilities Signed phollema$ ll bin
total 624
drwxr-xr-x 25 phollema admin 800 9 Apr 18:50 .
drwxr-xr-x 10 phollema admin 320 9 Apr 17:25 ..
-rw-r--r--# 1 phollema admin 6148 9 Apr 18:50 .DS_Store
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 CoastWatch Data Analysis Tool.app
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 CoastWatch Master Tool.app
drwxr-xr-x 3 phollema admin 96 9 Apr 17:24 CoastWatch Status Tool.app
-rwxr-xr-x 1 phollema admin 14801 9 Apr 17:12 cwangles
-rwxr-xr-x 1 phollema admin 14803 9 Apr 17:12 cwautonav
-rwxr-xr-x 1 phollema admin 14829 9 Apr 17:12 cwcomposite
-rwxr-xr-x 1 phollema admin 14827 9 Apr 17:12 cwcoverage
-rwxr-xr-x 1 phollema admin 14805 9 Apr 17:12 cwdownload
-rwxr-xr-x 1 phollema admin 14801 9 Apr 17:12 cwexport
-rwxr-xr-x 1 phollema admin 14827 9 Apr 17:12 cwgraphics
-rwxr-xr-x 1 phollema admin 14789 9 Apr 17:12 cwgscript
-rwxr-xr-x 1 phollema admin 14823 9 Apr 17:12 cwimport
-rwxr-xr-x 1 phollema admin 14797 9 Apr 17:12 cwinfo
-rwxr-xr-x 1 phollema admin 14819 9 Apr 17:12 cwmath
-rwxr-xr-x 1 phollema admin 14805 9 Apr 17:12 cwnavigate
-rwxr-xr-x 1 phollema admin 14829 9 Apr 17:12 cwregister
-rwxr-xr-x 1 phollema admin 14831 9 Apr 17:12 cwregister2
-rwxr-xr-x 1 phollema admin 14823 9 Apr 17:12 cwrender
-rwxr-xr-x 1 phollema admin 14801 9 Apr 17:12 cwsample
-rwxr-xr-x 1 phollema admin 14841 9 Apr 17:12 cwscript
-rwxr-xr-x 1 phollema admin 14799 9 Apr 17:12 cwstats
-rwxr-xr-x 1 phollema admin 14763 9 Apr 17:12 hdatt
Peters-MacBook-Pro-16:CoastWatch Utilities Signed phollema$ ll lib/native/macosx_x86_64/
total 12544
drwxr-xr-x 4 phollema admin 128 9 Apr 17:25 .
drwxr-xr-x 3 phollema admin 96 9 Apr 17:25 ..
-rw-r--r-- 1 phollema admin 1748128 9 Apr 17:12 libjhdf.dylib
-rw-r--r-- 1 phollema admin 3536000 9 Apr 17:12 libjhdf5.dylib
Also, the console launcher scripts contain a line that adds to the DYLD_LIBRARY_PATH like this:
DYLD_LIBRARY_PATH="$app_home/lib/native/macosx_x86_64:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH
All of this works if I don't sign the media file, and the console launcher scripts are identical.
Notarization requires enabling the "Hardened runtime" which prevents the use of DYLD_LIBRARY_PATH unless a specific entitlement is set for the launcher executable. As of install4j 9.0.1, entitlements can only be set for GUI launchers and not for the java executable of a bundled JRE which is what would be needed for command line launchers.
However, setting -Djava.library.path is a good solution and preferable to setting entitlements.

tomcat 8 stopped working after ubuntu update

I have recently updates my ubuntu deskto to 18.04. After this my tomcat is failing at startup. Each time I restart tomcat using the command service tomcat8 restart the log file give the following error -
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture.get(LRUHybridCache.java:164)
at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:303)
... 135 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2268)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:108)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities$3.run(ClassReflectionHelperUtilities.java:104)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.secureGetDeclaredMethods(ClassReflectionHelperUtilities.java:104)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getDeclaredMethodWrappers(ClassReflectionHelperUtilities.java:133)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:192)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperUtilities.getAllMethodWrappers(ClassReflectionHelperUtilities.java:193)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:84)
at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl$3.compute(ClassReflectionHelperImpl.java:80)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:115)
at org.glassfish.hk2.utilities.cache.LRUHybridCache$OriginThreadAwareFuture$1.call(LRUHybridCache.java:111)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
I then installed jdk8 and run update-alternatives command like this -
dimension:bin$ sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1101 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1101 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:
dimension:bin$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:
When I again restarted the tomcat, I saw the same error. Here are the contents to my jvm folder -
ls -lh /usr/lib/jvm/
total 8.0K
lrwxrwxrwx 1 root root 25 Apr 8 18:46 default-java -> java-1.11.0-openjdk-amd64
lrwxrwxrwx 1 root root 21 Aug 24 23:06 java-1.11.0-openjdk-amd64 -> java-11-openjdk-amd64
drwxr-xr-x 9 root root 4.0K Oct 4 10:56 java-11-openjdk-amd64
lrwxrwxrwx 1 root root 20 Oct 28 2016 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
drwxr-xr-x 7 root root 4.0K Oct 4 16:03 java-8-openjdk-amd64
My JAVA_HOME env is currently set to empty.
What should I do to fix my issue.
The java.base part of exception stack trace at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) suggests that you are still running with JDK 11.
Ensure that Tomcat 8 is running with JDK 8. Try debugging the Tomcat startup script with set -x to see how is the Java location determined, maybe it's set in /etc/default/tomcat8?

Docker and Java - FontConfiguration issue

We've got a Java application that generates word documents using a 3rd party (Asposee but I don't think it matters here). The app is built from a simple Docker file:
FROM openjdk:10-jdk-slim
COPY target/*.jar /opt/
CMD $JAVA_HOME/bin/java $JAVA_OPTS -jar /opt/*.jar
When we build the application locally (mvn package then docker build) and run the application inside k8s it works well.
However, when we build the image in our CI/CD pipeline with Jenkins we get a runtime exception when running through a specific process which apparently requires additional fonts:
Caused by: java.lang.NullPointerException: null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1288)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:765)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:440)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:385)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
In that case the project is buit in Jenkins, compiled by the docker image maven:3.5.4-jdk-10-slim.
I've checked both jar files (locally and from jenkins) and the class files are the same (as expected).
In both cases it's the same base image so I don't understand what could be the difference. Is something different in Docker when building locally vs inside another Docker container?
EDIT
We've looked into both docker images and found the following difference.
Since locally built image ls -l /usr/lib returns:
drwxr-xr-x 2 root root 4096 May 3 2017 X11
drwxr-xr-x 5 root root 4096 Apr 26 00:00 apt
drwxr-xr-x 2 root root 4096 May 26 08:31 binfmt.d
drwxr-xr-x 2 root root 4096 Jun 6 01:50 cgmanager
drwxr-xr-x 2 root root 4096 Jun 6 01:50 dbus-1.0
drwxr-xr-x 2 root root 4096 Jun 6 01:51 dconf
drwxr-xr-x 3 root root 4096 Jun 6 01:51 debug
drwxr-xr-x 3 root root 4096 Apr 20 10:08 dpkg
drwxr-xr-x 2 root root 4096 Jun 6 01:50 environment.d
drwxr-xr-x 3 root root 4096 Apr 25 04:56 gcc
drwxr-xr-x 2 root root 4096 Jun 6 01:51 glib-networking
drwxr-xr-x 2 root root 4096 Apr 26 00:00 init
drwxr-xr-x 1 root root 4096 Jun 6 01:51 jvm
drwxr-xr-x 3 root root 4096 Jun 6 01:50 kernel
lrwxrwxrwx 1 root root 20 Mar 4 09:49 libnih-dbus.so.1 -> libnih-dbus.so.1.0.0
-rw-r--r-- 1 root root 34824 Mar 4 09:49 libnih-dbus.so.1.0.0
lrwxrwxrwx 1 root root 15 Mar 4 09:49 libnih.so.1 -> libnih.so.1.0.0
-rw-r--r-- 1 root root 92184 Mar 4 09:49 libnih.so.1.0.0
drwxr-xr-x 3 root root 4096 Mar 29 19:47 locale
drwxr-xr-x 3 root root 4096 Jun 6 01:50 lsb
drwxr-xr-x 1 root root 4096 Jul 21 2017 mime
drwxr-xr-x 2 root root 4096 Jun 6 01:50 modprobe.d
drwxr-xr-x 2 root root 4096 May 26 08:31 modules-load.d
-rw-r--r-- 1 root root 198 Jan 13 23:36 os-release
drwxr-xr-x 3 root root 4096 Jun 6 01:51 ssl
drwxr-xr-x 1 root root 4096 Jun 6 01:50 systemd
drwxr-xr-x 2 root root 4096 Jun 6 01:50 sysusers.d
drwxr-xr-x 2 root root 4096 Jul 21 2017 tar
drwxr-xr-x 15 root root 4096 Feb 11 20:06 terminfo
drwxr-xr-x 1 root root 4096 Jun 6 01:50 tmpfiles.d
drwxr-xr-x 1 root root 4096 Apr 26 00:00 udev
drwxr-xr-x 1 root root 16384 Jun 6 01:51 x86_64-linux-gnu
But inside Jenkins built image ls -l /usr/lib returns:
drwxr-xr-x 5 root root 4096 Jun 25 00:00 apt
drwxr-xr-x 3 root root 4096 Jul 3 01:00 debug
drwxr-xr-x 3 root root 4096 Apr 20 10:08 dpkg
drwxr-xr-x 3 root root 4096 Jun 17 03:36 gcc
drwxr-xr-x 2 root root 4096 Jun 25 00:00 init
drwxr-xr-x 1 root root 4096 Jul 3 01:00 jvm
drwxr-xr-x 1 root root 4096 Jul 12 11:00 locale
drwxr-xr-x 3 root root 4096 Jul 3 01:00 lsb
drwxr-xr-x 1 root root 4096 May 16 07:47 mime
-rw-r--r-- 1 root root 198 Jan 13 23:36 os-release
drwxr-xr-x 3 root root 4096 Jul 3 01:00 ssl
drwxr-xr-x 3 root root 4096 Apr 20 10:08 systemd
drwxr-xr-x 2 root root 4096 May 16 07:47 tar
drwxr-xr-x 15 root root 4096 May 21 08:54 terminfo
drwxr-xr-x 2 root root 4096 Jun 25 00:00 tmpfiles.d
drwxr-xr-x 3 root root 4096 Jun 25 00:00 udev
drwxr-xr-x 2 root root 4096 May 3 2017 X11
drwxr-xr-x 1 root root 4096 Jul 3 01:00 x86_64-linux-gnu
This is really puzzling as I thought Docker would always produce the same image from identical Dockerfiles
With openjdk:8u111-jdk-alpine, installing dejavu fix the problem:
For example:
Dockerfile:
FROM openjdk:8u111-jdk-alpine
# Needed to fix 'Fontconfig warning: ignoring C.UTF-8: not a valid language tag'
ENV LANG en_GB.UTF-8
# JRE fails to load fonts if there are no standard fonts in the image; DejaVu is a good choice,
# see https://github.com/docker-library/openjdk/issues/73#issuecomment-207816707
RUN apk add --update ttf-dejavu && rm -rf /var/cache/apk/*
VOLUME /tmp
COPY /target/*.jar app.jar
ENTRYPOINT ["java","-Xmx100m","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Just add the following in your Dockerfile
RUN apk add --no-cache fontconfig ttf-dejavu
Installing libfontconfig1 solved the problem for me (source):
RUN apt-get install -y libfontconfig1 && rm -rf /var/lib/apt/lists/*
I think we found the problem.
When running on Jenkins we use the docker:dind (Docker inside docker) Docker image to provide the docker command in the build. This image is based on Alpine linux. When running docker info we get the following:
On Mac:
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
On Jenkins:
Kernel Version: 4.4.115-k8s
Operating System: Alpine Linux v3.7 (containerized)
Alpine linux must be missing those fonts. We fixed the problem by manually installing them in the Dockerfile:
RUN apt-get update \
&& apt-get install --assume-yes apt-utils \
&& apt-get install --assume-yes software-properties-common \
&& apt-get install --assume-yes dbus \
&& apt-get install --assume-yes cgmanager \
&& apt-get install --assume-yes glib-networking \
&& apt-get install --assume-yes libnih-dbus-dev \
&& apt-get install --assume-yes dconf-cli \
&& apt-get install --assume-yes fontconfig
Not sure this is the minimum required libraries but those did the trick :D
If you trying to do in Java/Spring boot , adding following in Dockerfile worked for me in java 11.
# Font packages to be added for java 11
RUN apk update \
&& apk add fontconfig \
&& apk add ttf-dejavu
RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so && \
ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so.1 && \
ln -s /lib/libc.musl-x86_64.so.1 /usr/lib/libc.musl-x86_64.so.1
ENV LD_LIBRARY_PATH /usr/lib
If you are running it on local with Docker Desktop and using docker file to create the image.
Please make changes in Dockerfile from FROM openjdk:8-jdk-alpine to FROM adoptopenjdk/openjdk11:ubi
Problem NullPointerException with fonts occurs when you use openjdk docker image in alpine version for example :
adoptopenjdk/openjdk11:jre-11.0.11_9-alpine.
You need change image to full version: adoptopenjdk/openjdk11:jre-11.0.11_9
I also got the same issue while running below command and restart app server resolved this issue.
Yup install fontconfig

Updating java 6 cacerts with those from java 8

Rackspace replaced an outdated certificate, ive followed their instructions using keytool to update the cacerts for java 6 with no success (keytool).
What did work was just replacing the cacerts file from java 6 with one from java 8.
Is this "OK" to do? i assume formats between the two are the same and they are simply updated between version.
Apologies in advance if this is a stupid question
I initially did the same thing, and then symlinked to the java 8 file. But my problem was that the java 6 installation on macOs High Sierra (10.13.x).
# store path to java 6 home
tmp $ j6Security=$(/usr/libexec/java_home -v '1.6*')/lib/security;
# show pre-update state
tmp $ ls -la "$j6Security"
total 16
drwxr-xr-x 10 root wheel 320 Jan 20 19:39 .
drwxr-xr-x 41 root wheel 1312 Jan 20 19:39 ..
-rw-r--r-- 1 root wheel 2469 Jul 14 2015 US_export_policy.jar
lrwxr-xr-x 1 root wheel 79 Jan 20 19:39 blacklist -> /System/Library/Java/Support/Deploy.bundle/Contents/Home/lib/security/blacklist
lrwxr-xr-x 1 root wheel 81 Jan 20 19:39 cacerts -> /System/Library/Java/Support/CoreDeploy.bundle/Contents/Home/lib/security/cacerts
-rw-r--r-- 1 root wheel 3443 Jul 14 2015 java.policy
-rw-r--r-- 1 root wheel 13458 Jul 14 2015 java.security
-rw-r--r-- 1 root wheel 2486 Jul 14 2015 local_policy.jar
-rw-r--r-- 1 root wheel 347 Jul 14 2015 sunpkcs11-macosx.cfg
lrwxr-xr-x 1 root wheel 87 Jan 20 19:39 trusted.libraries -> /System/Library/Java/Support/Deploy.bundle/Contents/Home/lib/security/trusted.libraries
# store path to current (i.e., switcher) home
tmp $ jXSecurity=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security;
# replace (broken) j6 files with symlink to current files
tmp $ for file in blacklist cacerts trusted.libraries; do src="${jXSecurity}/${file}" tgt="${j6Security}/${file}"; test -f $tgt && sudo rm $tgt; sudo ln -s "$src" "$tgt"; done
# show post-update state
tmp $ ls -la "$j6Security"
total 16
drwxr-xr-x 10 root wheel 320 Jan 20 20:33 .
drwxr-xr-x 41 root wheel 1312 Jan 20 19:39 ..
-rw-r--r-- 1 root wheel 2469 Jul 14 2015 US_export_policy.jar
lrwxr-xr-x 1 root wheel 87 Jan 20 20:33 blacklist -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/blacklist
lrwxr-xr-x 1 root wheel 85 Jan 20 20:33 cacerts -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/cacerts
-rw-r--r-- 1 root wheel 3443 Jul 14 2015 java.policy
-rw-r--r-- 1 root wheel 13458 Jul 14 2015 java.security
-rw-r--r-- 1 root wheel 2486 Jul 14 2015 local_policy.jar
-rw-r--r-- 1 root wheel 347 Jul 14 2015 sunpkcs11-macosx.cfg
lrwxr-xr-x 1 root wheel 95 Jan 20 20:33 trusted.libraries -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/trusted.libraries
If I wanted to pin j8, I would replace jXSecurity=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/trusted.libraries with j8Security=$(/usr/libexec/java_home -v '1.8*'). Both this and copying the files (that I've symlinked in this example) worked fine.
(In my case the installed symlinks (in the "pre-update" output) pointed to nonexistent files. My maven downloads were failing with "peer not authenticated". After applying these changes to my jdk6 installation everything began working again.)

java.io.FileNotFoundException: File does not exist: hdfs://localhost:9000/home/hduser/sqoop/lib/hsqldb-1.8.0.10.jar

I am basically a mysql guy and new in hadoop and trying to import one mysql table on my hadoop system by sqoop and using below command but getting error. I search on net but not getting any possible solution.
I will be very thankful for your support.
[hduser#localhost ~]$ sqoop-import --connect jdbc:mysql://192.168.12.172:3306/test --username root -P --table users_log
Error:
15/02/25 16:26:40 ERROR tool.ImportTool: Encountered IOException running import job: java.io.FileNotFoundException: File does not exist: hdfs://localhost:9000/home/hduser/sqoop/lib/hsqldb-1.8.0.10.jar
Even This file exist on same path, details are below-
[hduser#localhost ~]$ ls -lh /home/hduser/sqoop/lib/
total 5.1M
-rwxr-xr-x 1 hduser hadoop 220K Aug 1 2014 ant-contrib-1.0b3.jar
-rwxr-xr-x 1 hduser hadoop 36K Aug 1 2014 ant-eclipse-1.0-jvm1.2.jar
-rwxr-xr-x 1 hduser hadoop 392K Aug 1 2014 avro-1.7.5.jar
-rwxr-xr-x 1 hduser hadoop 167K Aug 1 2014 avro-mapred-1.7.5-hadoop2.jar
-rwxr-xr-x 1 hduser hadoop 236K Aug 1 2014 commons-compress-1.4.1.jar
-rwxr-xr-x 1 hduser hadoop 107K Aug 1 2014 commons-io-1.4.jar
-rwxr-xr-x 1 hduser hadoop 691K Aug 1 2014 hsqldb-1.8.0.10.jar
-rwxr-xr-x 1 hduser hadoop 227K Aug 1 2014 jackson-core-asl-1.9.13.jar
-rwxr-xr-x 1 hduser hadoop 763K Aug 1 2014 jackson-mapper-asl-1.9.13.jar
-rwxr-xr-x 1 hduser hadoop 932K Mar 11 2014 mysql-connector-java-5.1.30-bin.jar
-rwxr-xr-x 1 hduser hadoop 29K Aug 1 2014 paranamer-2.3.jar
-rwxr-xr-x 1 hduser hadoop 1.2M Aug 1 2014 snappy-java-1.0.5.jar
-rwxr-xr-x 1 hduser hadoop 93K Aug 1 2014 xz-1.0.jar
hdfs://localhost:9000/ is hadoop hdfs address.
you can change property in your app or upload your jar on hdfs.
You display ls command of your linux file system but hdfs://localhost:9000/ is addres of hadoop hdfs file system.
Please execute below commands which will resolve your problem. It will copy your files in HDFS system.
hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6 hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6
hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6/lib hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6/lib
Note : please treat below curly braces inline section as one line
{hdfs dfs -copyFromLocal /opt/hadoop/sqoop-1.4.6/sqoop-1.4.6.jar hdfs://localhost:9000/opt/hadoop/sqoop-1.4.6/sqoop-1.4.6.jar}
Similarly copy any file which is not able to get by HDFS system.
Note : In above command /opt/hadoop/sqoop-1.4.6 is my system sqoop installation location
Thanks, Iqubal Mustafa Kaki

Categories

Resources