tomcat 8 stopped working after ubuntu update - java

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?

Related

Using tcnative module on AIX for HTTP2 on Tomcat

Has anyone successfully got the HTTP/2 connector working in Tomcat9 on AIX (e.g. powerpc-ibm-aix7.2.5.0)?
I followed the instructions here to build the tcnative module (using tomcat-native-1.2.24-src that comes with Tomcat 9.0.37, APR 1.5.2, OpenSSL 1.0.2, IBM Java 1.8.0_261) i.e.
$ ./configure --with-apr=/opt/freeware/bin/apr-1-config --with-java-home=/app/java8_64/ --with-ssl=yes --prefix=/app/tomcat
followed by
make && make install
This creates the expected entries in /app/tomcat/lib, i.e.
-rw-r--r-- 1 usrxxx grpxxxx 3440287 Mar 03 16:47 libtcnative-1.a
-rwxr-xr-x 1 usrxxx grpxxxx 1057 Mar 03 16:47 libtcnative-1.la
lrwxrwxrwx 1 usrxxx grpxxxx 23 Mar 03 16:47 libtcnative-1.so -> libtcnative-1.so.0.2.24
lrwxrwxrwx 1 usrxxx grpxxxx 23 Mar 03 16:47 libtcnative-1.so.0 -> libtcnative-1.so.0.2.24
-rwxr-xr-x 1 usrxxx grpxxxx 1372146 Mar 03 16:47 libtcnative-1.so.0.2.24
but when Tomcat starts I get
04-Mar-2021 15:30:00.752 WARNING [main] org.apache.catalina.core.AprLifecycleListener.init The Apache Tomcat Native library failed to load. The error reported was [tcnative-1 (Not found in java.library.path)]
java.lang.UnsatisfiedLinkError: tcnative-1 (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1462)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1414)
at java.lang.System.loadLibrary(System.java:584)
at org.apache.tomcat.jni.Library.<init>(Library.java:69)
at org.apache.tomcat.jni.Library.initialize(Library.java:206)
at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:198)
...
04-Mar-2021 15:30:01.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.library.path=/app/java8_64/jre/lib/ppc64/compressedrefs:/app/java8_64/jre/lib/ppc64:/app/java8_64/jre/lib/ppc64/j9vm:/app/java8_64/jre/lib/ppc64:/app/java8_64/jre/../lib/ppc64:/app/java8_64/jre/lib/icc:/opt/freeware/lib:/opt/freeware/lib64:/usr/lib:/usr/lib64:/app/tomcat/lib:/usr/lib64:/usr/lib
...
04-Mar-2021 15:30:02.233 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]] org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1024)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1057)
Edit - based on suggestions from Piotr and Lorinczy:
Tried adding tcnative-1.so as a symlink - same error
Copied libtcnative-1.* to the bin folder. Still failing but new error (progress!?). Possible 32bit v 64bit issue?
09-Mar-2021 10:10:07.116 WARNING [main] org.apache.catalina.core.AprLifecycleListener.init The Apache Tomcat Native library failed to load. The error reported was [/app/apache-tomcat-9.0.37/bin/libtcnative-1.a ( 0509-022 Cannot load module /app/apache-tomcat-9.0.37/bin/libtcnative-1.a.
0509-026 System error: Cannot run a file that does not have a valid format.)]
java.lang.UnsatisfiedLinkError: /app/apache-tomcat-9.0.37/bin/libtcnative-1.a ( 0509-022 Cannot load module /app/apache-tomcat-9.0.37/bin/libtcnative-1.a.
0509-026 System error: Cannot run a file that does not have a valid format.)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1462)
...
All the dependencies seem to be available
$ldd libtcnative-1.so.0.2.24
libtcnative-1.so.0.2.24 needs:
/usr/lib/libssl.so
/usr/lib/libcrypto.so
/opt/freeware/lib/libapr-1.so
/usr/lib/libpthread.a(shr_xpg5.o)
/usr/lib/libc.a(shr.o)
/opt/freeware/lib/libgcc_s.a(shr.o)
/usr/lib/libcrypto.a(libcrypto.so.1.0.2)
/unix
/usr/lib/libpthreads.a(shr_comm.o)
/usr/lib/libcrypt.a(shr.o)
but the dump command seems to support the 32 v 64 bit theory:
$ dump -H -X64 libtcnative-1.so.0.2.24
libtcnative-1.so.0.2.24:
dump: libtcnative-1.so.0.2.24: 0654-108 file is not valid in the current object file mode.
Use the -X option to specify the desired object mode.
$ dump -H -X32 libtcnative-1.so.0.2.24
libtcnative-1.so.0.2.24:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x00000364 0x00000771 0x00000084
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000007 0x0000aacc 0x00006406 0x0000ab50
***Import File Strings***
INDEX PATH BASE MEMBER
0 /opt/freeware/lib:/usr/lib:/lib
1 libssl.so
2 libcrypto.so
3 libapr-1.so
4 libpthread.a shr_xpg5.o
5 libc.a shr.o
6 libgcc_s.a shr.o
It looks like only the 32-bit version of APR is currently available on the server also. I will update once I can get the 64-bit version installed.
Further Updates
The commands I am trying now are:
$ export CFLAGS=-maix64
$ export OBJECT_MODE=64
$ ./configure --with-apr=/opt/freeware/bin/apr-1-config_64 --with-java-home=/app/java8_64/ --with-ssl=/usr/include/openssl --prefix=/app/tomcat
$ make && make install
No errors but same outcome however. This doesn't seem to build a 64 bit version of the tomcat native module (if that is the issue).

Not able to load TestNG/ Ant jars Via Jenkins

Created a TestNG suite and everything is working fine with Eclipse.
Problem starts when trying to run my suite with Jenkins.
Jenkins are hosted on one server having java version :
java version "1.7.0_151"
OpenJDK Runtime Environment (rhel-2.6.11.0.el6_9-x86_64 u151-b00)
OpenJDK 64-Bit Server VM (build 24.151-b00, mixed mode)
Suite Structure:
drwxrwxrwx. 11 jenkins jenkins 4096 Jul 10 03:21 .
drwxr-xr-x. 4 jenkins jenkins 4096 Jul 9 11:55 ..
drwxrwxrwx. 2 jenkins jenkins 4096 Jul 10 03:21 bin
-rwxrwxrwx. 1 jenkins jenkins 8985 Jul 10 03:21 .classpath
drwxrwxrwx. 4 jenkins jenkins 4096 Jul 10 03:21 dependencies
-rwxrwxrwx. 1 jenkins jenkins 19039 Jul 10 03:21 HelpText.xlsx
-rwxrwxrwx. 1 jenkins jenkins 39902 Jul 10 03:21 Import project in eclipse.docx
drwxrwxrwx. 2 jenkins jenkins 4096 Jul 10 03:21 lib
-rwxrwxrwx. 1 jenkins jenkins 302 Jul 10 03:21 log4j.properties
drwxrwxrwx. 3 jenkins jenkins 4096 Jul 9 11:55 Mac
-rwxrwxrwx. 1 jenkins jenkins 389 Jul 10 03:21 .project
-rwxrwxrwx. 1 jenkins jenkins 657005 Jul 10 03:21 selenium-java-2.53.1-srcs.jar
drwxrwxrwx. 2 jenkins jenkins 4096 Jul 10 03:21 .settings
drwxrwxrwx. 4 jenkins jenkins 4096 Jul 9 11:55 src
drwxrwxrwx. 2 jenkins jenkins 4096 Jul 10 03:21 TestExecutionLogs
-rwxrwxrwx. 1 jenkins jenkins 361 Jul 10 03:21 testng.xml
drwxrwxrwx. 6 jenkins jenkins 4096 Jul 10 03:21 test-output
drwxrwxrwx. 3 jenkins jenkins 4096 Jul 9 11:55 Win
Build command:
set
classpath=/var/lib/jenkins/workspace/testing/CC_Regression/bin;/var/lib/jenkins/workspace/testing/CC_Regression/lib/*
java org.testng.TestNG testng.xml
Build console Output:
+ set classpath=/var/lib/jenkins/workspace/testing/CC_Regression/bin
+ /var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-1.7.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-launcher-1.7.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/apache-mime4j-0.6.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/bsh-2.0b4.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/bson-3.0.4.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/cglib-nodep-2.1_3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/commons-codec-1.10.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/commons-collections4-
4.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/commons-exec-
1.3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/commons-io-2.4.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/commons-logging-1.2.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/curvesapi-1.04.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/extent-config.xml
/var/lib/jenkins/workspace/testing/CC_Regression/lib/extentreports-2.41.2.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/extentreports-3.0.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/Flash.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/freemarker-2.3.23.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/gson-2.3.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/guava-19.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/hamcrest-core-1.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/hamcrest-core-1.3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/hamcrest-library-1.3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/httpclient-4.5.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/httpcore-4.4.3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/httpmime-4.5.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/jcommander-1.48.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/jna-4.1.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/jna-platform-4.1.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/jsoup-1.8.3.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/junit-4.10.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/junit-4.12.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/log4j-1.2.17.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/log4j-api-2.7.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/log4j-api-2.7-
javadoc.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/log4j-api-2.7-
sources.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/log4j.properties
/var/lib/jenkins/workspace/testing/CC_Regression/lib/mongodb-driver-
3.0.4.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/mongodb-driver-core-
3.0.4.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/netty-3.5.7.Final.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/phantomjsdriver-
1.2.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-examples-3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-excelant-3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-ooxml-3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-ooxml-schemas-
3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/poi-scratchpad-3.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/selenium-java-
2.53.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/selenium-java-2.53.0-
srcs.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/selenium-server-
standalone-2.53.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/sikulixapi.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/sikulix.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/snakeyaml-1.15.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/sqlite-jdbc-
3.8.11.1.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/testng-6.9.9.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/xmlbeans-2.6.0.jar
/var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-1.7.0.jar: line 1:
PK: command not found
/var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-1.7.0.jar: line 2:
�9�5: command not found
/var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-1.7.0.jar: line 3:
syntax error near unexpected token `K+:%���-
���������w�#����C��6jeJ'
/var/lib/jenkins/workspace/testing/CC_Regression/lib/ant-1.7.0.jar: line 3:
`�9�5�R����META-
INF/MANIFEST.MF�ϱN�0�ݒ���T$�uQ+u(K+:%���-
���������w�#����C��6jeJ)*�L*�;�q6��)�c�?
��3�k����\T���j7�c�U{j��F�X�u1n�o�N���ѱI#'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Note: When trying with Locally installed Jenkins and all worked well.
Local system --> Java version details
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Please suggest

Oracle JDK installation on Yocto build

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.

Unable to find a javac compiler even when JDK present

I'm trying to run an Apache Hive web interface, so I downloaded the lastest version of ant (Ant 1.9.4), and when I execute the command to produce the hive.war file
ANT_LIB=/opt/ant/lib bin/hive --service hwi
I get the following error:
cp=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
cp=null
work dir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
extension dir=/usr/lib/jvm/jdk1.7.0_65/jre/lib/ext:/usr/java/packages/lib/ext
srcDir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
compilerTargetVM=1.5
compilerSourceVM=1.5
include=org/apache/jsp/index_jsp.java
15/02/23 09:56:59 ERROR compiler.Compiler: Error compiling file: /tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp//org/apache/jsp/index_jsp.java [javac] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
15/02/23 09:56:59 ERROR mortbay.log: /hwi/
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/jdk1.7.0_65/jre"
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:130)
at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:984)
at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:961)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:932)
at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:220)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
I'm executing that code as root. My JAVA_HOME is correctly set at the .bashrc:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
export HADOOP_LIBEXEC_DIR=/usr/lib/hadoop/libexec
export HADOOP_CONF_DIR=/etc/hadoop/conf
export PATH=$PATH:$JAVA_HOME/bin
and .bash_profile files:
.bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export PATH
I want to know why is Ant referencing the javac at "/usr/lib/jvm/jdk1.7.0_65/jre". Moreover, here is my JDK structure:
[root#ip-10-32-205-19 ~]# cd $JAVA_HOME
[root#ip-10-32-205-19 jdk1.7.0_65]# ls -l
total 19760
drwxr-xr-x. 2 root root 4096 Feb 23 04:09 bin
-r--r--r--. 1 root root 3339 Jun 17 2014 COPYRIGHT
drwxr-xr-x. 4 root root 4096 Jun 17 2014 db
drwxr-xr-x. 3 root root 4096 Jun 17 2014 include
drwxr-xr-x. 5 root root 4096 Jun 17 2014 jre
drwxr-xr-x. 5 root root 4096 Feb 23 04:09 lib
-r--r--r--. 1 root root 40 Jun 17 2014 LICENSE
drwxr-xr-x. 4 root root 4096 Jun 17 2014 man
-r--r--r--. 1 root root 114 Jun 17 2014 README.html
-rw-r--r--. 1 root root 499 Jun 17 2014 release
-rw-r--r--. 1 root root 19902785 Jun 17 2014 src.zip
-rw-r--r--. 1 root root 110114 Jun 16 2014 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--. 1 root root 173559 Jun 17 2014 THIRDPARTYLICENSEREADME.txt
which shows I have the JDK, and not only the JRE installed. I also took a look at similar questions, but none could solve my problem. The Java is 64bits, plus I also ran source for both .bashrc and .bash_profile.
The error message says:
Perhaps JAVA_HOME does not point to the JDK. It is currently set to
"/usr/lib/jvm/jdk1.7.0_65/jre"
However, your .bashrc has:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
You likely need to run source ~/.bashrc in your Bash shell to reset JAVA_HOME to the root of your JDK installation. Then run Ant again.

VisualVM can not start

I have a remote Debian Squeeze server. I've installed Oracle JDK 1.7.0_07 manually and configured alternatives to every binary in jdk/bin path. Also i exported the global JAVA_HOME variable.
# java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)
#
Server has Gnome on board and I'm connecting with putty and X-Windows forwarding enabled.
But when I'm trying to launch VisualVM with jvisualvm command I just get nothing with 5-10 sec pause:
# jvisualvm
#
And when I try to show help, I see an Exception:
# jvisualvm --help
Usage: /usr/java/jdk1.7.0_07/bin/../lib/visualvm//platform/lib/nbexec {options} arguments
General options:
--help show this help
--jdkhome <path> path to Java(TM) 2 SDK, Standard Edition
-J<jvm_option> pass <jvm_option> to JVM
--cp:p <classpath> prepend <classpath> to classpath
--cp:a <classpath> append <classpath> to classpath
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.netbeans.core.startup.Splash$SplashComponent
at org.netbeans.core.startup.Splash.<init>(Splash.java:111)
at org.netbeans.core.startup.Splash.getInstance(Splash.java:64)
at org.netbeans.core.startup.Main.setStatusText(Main.java:47)
at org.netbeans.core.startup.NbEvents.setStatusText(NbEvents.java:384)
at org.netbeans.core.startup.NbEvents.logged(NbEvents.java:159)
at org.netbeans.Events.log(Events.java:127)
at org.netbeans.core.startup.ModuleList.readInitial(ModuleList.java:129)
at org.netbeans.core.startup.ModuleSystem.readList(ModuleSystem.java:241)
at org.netbeans.core.startup.CLICoreBridge.usage(CLICoreBridge.java:69)
at org.netbeans.CLIHandler.showHelp(CLIHandler.java:125)
at org.netbeans.CLIHandler.checkHelp(CLIHandler.java:179)
at org.netbeans.CLIHandler.initialize(CLIHandler.java:530)
at org.netbeans.CLIHandler.initialize(CLIHandler.java:346)
at org.netbeans.MainImpl.execute(MainImpl.java:151)
at org.netbeans.MainImpl.main(MainImpl.java:46)
at org.netbeans.Main.main(Main.java:39)
I googled that exception and found out that the libxtst-dev library is missing, but I installed it previously.
So what is the problem, how can I figure out what is going wrong?
UPDATE:
I'm working under root.
I don't have other versions of JDK in the system, the default OpenJDK was removed with apt-get purge.
My CLASSPATH system variable is empty, is it a problem?
UPDATE2:
libXtst is in /usr/lib
root#test:/usr/lib# ls -la /usr/lib | grep libXtst
-rw-r--r-- 1 root root 26666 Июн 23 2010 libXtst.a
lrwxrwxrwx 1 root root 16 Окт 7 01:18 libXtst.so -> libXtst.so.6.1.0
lrwxrwxrwx 1 root root 16 Окт 6 20:26 libXtst.so.6 -> libXtst.so.6.1.0
-rw-r--r-- 1 root root 23616 Июн 23 2010 libXtst.so.6.1.0
libXext is also in /usr/lib
root#test:~# ls -la /usr/lib | grep libXext
-rw-r--r-- 1 root root 118668 Июл 11 2010 libXext.a
lrwxrwxrwx 1 root root 16 Окт 6 22:26 libXext.so -> libXext.so.6.4.0
lrwxrwxrwx 1 root root 16 Май 21 13:42 libXext.so.6 -> libXext.so.6.4.0
-rw-r--r-- 1 root root 74432 Июл 11 2010 libXext.so.6.4.0
root#test:~#
here is output for command jvisualvm -J-Dnetbeans.logger.console=true
root#test:~# jvisualvm -J-Dnetbeans.logger.console=true
-------------------------------------------------------------------------------
>Log Session: Monday, October 8, 2012 10:48:32 PM MSK
>System Info:
Product Version = Java VisualVM
Operating System = Linux version 2.6.32-5-amd64 running on i386
Java; VM; Vendor = 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01; Oracle Corporation
Runtime = Java(TM) SE Runtime Environment 1.7.0_07-b10
Java Home = /usr/java/jdk1.7.0_07/jre
System Locale; Encoding = ru_RU (visualvm); UTF-8
Home Directory = /root
Current Directory = /root
User Directory = /root/.visualvm/7u6
Cache Directory = /root/.visualvm/7u6/var/cache
Installation = /usr/java/jdk1.7.0_07/lib/visualvm/visualvm
/usr/java/jdk1.7.0_07/lib/visualvm/profiler
/usr/java/jdk1.7.0_07/lib/visualvm/platform
Boot & Ext. Classpath = /usr/java/jdk1.7.0_07/jre/lib/resources.jar:/usr/java/jdk1.7.0_07/jre/lib/rt.jar:/usr/java/jdk1.7.0_07/jre/lib/sunrsasign.jar:/usr/java/jdk1.7.0_07/jre/lib/jsse.jar:/usr/java/jdk1.7.0_07/jre/lib/jce.jar:/usr/java/jdk1.7.0_07/jre/lib/charsets.jar:/usr/java/jdk1.7.0_07/jre/lib/jfr.jar:/usr/java/jdk1.7.0_07/jre/classes:/usr/java/jdk1.7.0_07/jre/lib/ext/zipfs.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/dnsns.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/localedata.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunpkcs11.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunec.jar:/usr/java/jdk1.7.0_07/jre/lib/ext/sunjce_provider.jar
Application Classpath = /usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/boot.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-modules.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-util.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/org-openide-util-lookup.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/boot_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/boot_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-modules_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-modules_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util-lookup_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/lib/locale/org-openide-util_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/dt.jar:/usr/java/jdk1.7.0_07/lib/tools.jar
Startup Classpath = /usr/java/jdk1.7.0_07/lib/visualvm/platform/core/org-openide-filesystems.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/core.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/core_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/org-openide-filesystems_ja.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/core_zh_CN.jar:/usr/java/jdk1.7.0_07/lib/visualvm/platform/core/locale/org-openide-filesystems_zh_CN.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/com-sun-tools-visualvm-modules-startup.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/com-sun-tools-visualvm-modules-startup_ja.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/core_visualvm.jar:/usr/java/jdk1.7.0_07/bin/../lib/visualvm/visualvm/core/locale/com-sun-tools-visualvm-modules-startup_zh_CN.jar
-------------------------------------------------------------------------------
java.lang.UnsatisfiedLinkError: /usr/java/jdk1.7.0_07/jre/lib/i386/xawt/libmawt.so: libXext.so.6: Unable to open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:77)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at org.netbeans.core.startup.Main.start(Main.java:203)
at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:84)
at java.lang.Thread.run(Thread.java:722)
UPDATE 3
I downloaded Java demos and tried to launch SwingSet2:
root#test:/tmp/jdk1.7.0_06# java -jar demo/jfc/SwingSet2/SwingSet2.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/jdk1.7.0_07/jre/lib/i386/xawt/libmawt.so: libXext.so.6: unbale to open shared object file: no such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1648)
at java.awt.Toolkit.<clinit>(Toolkit.java:1670)
at java.awt.Component.<clinit>(Component.java:595)
UPDATE 4
finally my mistake was in the version of JDK, see accepted answer.
I think you found the correct answer when you googled for the exception. libXtst.so.6 is missing, it should be in /usr/lib directory. Are you sure that it is installed? Can you run any other Java GUI application like SwingSet2? Can you run VisualVM with -J-Dnetbeans.logger.console=true and post the output?
jvisualvm -J-Dnetbeans.logger.console=true
Resolution for MAC: [In my case nothing was happening when I was trying to open the app]
Goto Application folder, Show Contents -> Resources/visualvm/etc/visualvm.conf
Example:
/Applications/VisualVM.app/Contents/Resources/visualvm/etc/visualvm.conf
Uncomment "visualvm_jdkhome" and replace the value with the correct JDK home path.
Example:
visualvm_jdkhome="/Users/username/tools/jdk-11.0.10.jdk/Contents/Home"
Try opening the app again, It should open.

Categories

Resources