Tomcat APR native library not loaded *even* when present and configured - java

The system is Ubuntu 13.04 (64-bit). [Update: also tried on a 12.04 TLS 64-bit, same result]
I compiled the latest (1.4.8) library (process described here) and the files are readable by all:
$ ll /usr/local/apr/lib
-rw-r--r-- 1 root root 8351 Sep 12 19:29 apr.exp
-rw-r--r-- 1 root root 1608792 Sep 12 19:29 libapr-1.a
-rwxr-xr-x 1 root root 965 Sep 12 19:29 libapr-1.la*
lrwxrwxrwx 1 root root 17 Sep 12 19:29 libapr-1.so -> libapr-1.so.0.4.8*
lrwxrwxrwx 1 root root 17 Sep 12 19:29 libapr-1.so.0 -> libapr-1.so.0.4.8*
-rwxr-xr-x 1 root root 925622 Sep 12 19:29 libapr-1.so.0.4.8*
drwxr-xr-x 2 root root 4096 Sep 12 19:29 pkgconfig/
The environment variable is set in .bashrc and it's loaded:
LD_LIBRARY_PATH=/usr/local/apr/lib
I launched Tomcat's Java with -XshowSettings:properties which shows java.library.path contains that path.
java.library.path = /usr/local/apr/lib
/usr/java/packages/lib/amd64
/usr/lib64
/lib64
/lib
/usr/lib
Still, when Tomcat starts I get a message it didn't find it even though it displays the path to that directory.
Sep 12, 2013 8:14:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/apr/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
I'm really at a loss what could be the cause.
Thank you very much for any pointers.

Installation the native library on Ubuntu server with:
sudo apt-get install libtcnative-1
If that does not work tomcat-native needs to be installed
Install Oracle java7:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
Install tomcat apr:
wget http://apache.mirror.anlx.net//apr/apr-1.5.0.tar.gz
tar zxvf apr-1.5.0.tar.gz
rm apr-1.5.0.tar.gz
cd apr-1.5.0 *
sudo ./configure
sudo make
sudo make install
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
Install tomcat tomcat-native:
wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//tomcat/tomcat-connectors/native/1.1.29/source/tomcat-native-1.1.29-src.tar.gz
tar zxvf tomcat-native-1.1.29-src.tar.gz
rm tomcat-native-1.1.29-src.tar.gz
cd tomcat-native-1.1.29-src/jni/native
JAVA_HOME=/usr/lib/jvm/java-7-oracle
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install

I found the solution in the meantime. I also needed to install the native library support for Tomcat. Should anyone search for this, I downloaded tomcat-native-1.1.27-src (the latest at this time). The commands are below.
cd tomcat-native-1.1.27-src/jni/native
./configure --with-apr=/usr/local/apr --with-java-home=/home/foo/jdk1.7.0_25 --with-ssl=yes
make
sudo make install

Related

Need to source java-1.8.0-openjdk-amd64 specifically and install?

App throwing error at startup looking specifically for java-1.8.0-openjdk-amd64. Environment is Ubuntu1604. Java java-8-openjdk-i386 is already installed , but need the amd64 and then use it as an alternate. Where can I source amd64 tar file ? Have ran "sudo apt-get install openjdk-8-jdk". thx
2/6/21 current status - have not being able to install Java 8 AMD64.
Hi there, I tried :
sudo tar xvf jdk-8u291-linux-x64.tar.gz --directory /usr/lib/jvm/
and this installed to /usr/lib/jvm/jdk1.8.0_291.
However I was expecting /usr/lib/jvm/java-1.8.0-openjdk-amd64 folder structure.
Whats currently installed is:
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ ls -lrta
total 24
lrwxrwxrwx 1 root root 23 Feb 25 2016 default-java -> java-1.8.0-openjdk-i386
drwxr-xr-x 8 10143 10143 4096 Apr 7 20:26 jdk1.8.0_291
-rw-r--r-- 1 root root 2716 Apr 21 17:10 .java-1.8.0-openjdk-i386.jinfo
lrwxrwxrwx 1 root root 19 Apr 21 17:10 java-1.8.0-openjdk-i386 -> java-8-openjdk-i386
drwxr-xr-x 8 root root 4096 Jun 1 23:17 java-8-openjdk-i386
drwxr-xr-x 2 root root 4096 Jun 1 23:17 openjdk-8
drwxr-xr-x 69 root root 4096 Jun 1 23:43 ..
drwxr-xr-x 5 root root 4096 Jun 2 09:26 .
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK Server VM (build 25.292-b10, mixed mode)
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java
Nothing to configure.
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$
How can I complete the install. The app I'm trying to use is looking for :
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java
Answering your question as-is - you can find links to all jdk implementations on jdk.dev . But you'll have to extract jdk and add bin directory to PATH by yourself
As for updating alternatives it's a question for askubuntu.com, but I believe, that you should do install before updating.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_291/bin/java" 1

Cordova/Android not finding JDK on OSX and PATH/JAVA_HOME correct

So cordova requirements is still failing for Android after trying and verifying all paths, versions and suggestions. It's on OSX 10.10.5 and a clean install of Android SDKs/Studio and cordova. Have tried Apple recommended (export JAVA_HOME=/usr/libexec/java_home -v 1.8) and direct paths with same failed result. Have verified both java/javac are in the bin directory of the JDK path.
sh-3.2# cordova requirements
Requirements check results for android:
Java JDK: not installed
Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
Android SDK: installed
Android target: installed android-9,android-10,android-19,android-22,android-23,android-24,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
Error: Some of requirements check failed
sh-3.2# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/dzhon/bin:/opt/dzhon/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Users/rob/Library/Android/sdk/tools:/Users/rob/Library/Android/sdk/platform-tools:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin:/Users/rob/Documents/software/apache-ant-1.9.7/bin
sh-3.2# echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
sh-3.2# java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
sh-3.2# javac -version
javac 1.8.0_102
sh-3.2# node -v
v5.3.0
sh-3.2# cordova -v
6.2.0
and in ~/.bash_profile:
export ANT_HOME=/Users/rob/Documents/software/apache-ant-1.9.7
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export ANDROID_HOME=/Users/rob/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:${JAVA_HOME}/bin:$ANT_HOME/bin
have also checked all the symlinks:
sh-3.2# ls -la /System/Library/Frameworks/JavaVM.framework/Versions/
total 32
drwxr-xr-x 11 root wheel 374 20 Jul 11:54 .
drwxr-xr-x 12 root wheel 408 6 Jan 2016 ..
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.6.0 -> CurrentJDK
drwxr-xr-x 8 root wheel 272 6 Jan 2016 A
lrwxr-xr-x 1 root wheel 1 26 Mar 2015 Current -> A
lrwxr-xr-x 1 root wheel 59 20 Jul 11:54 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents
The only thing in digging through the source for cordova-android on gitHub is in check_reqs.js, the error message is:
Failed to run "javac -version", make sure that you have a JDK installed.
rather than as it currently reports:
Failed to run "java -version", make sure that you have a JDK installed.
Any help greatly appreciated.
Rob
So a number of issues. check_reqs.js is where the platform/environment checks are done (app/platforms/android/cordova/lib/). The call to forgivingWhichSync('javac') on line 98 was returning the non-JDK link (as it was using Current, not CurrentJDK):
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/javac
By repointing the Current symlink in /System/Library/Frameworks/JavaVM.framework/Versions/ to CurrentJDK it fixed this first issue:
lrwxr-xr-x 1 root wheel 10 21 Jul 12:03 Current -> CurrentJDK
lrwxr-xr-x 1 root wheel 59 21 Jul 12:06 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents
The next issue was a problem with the tryCommand method testing javac. As correctly noted, javac -version returns the information in stderr. The issue (at least on OSX) is that the call to child_process.exec on line 44 also returns information in err:
Error: Command failed: /bin/sh -c javac -version
javac 1.8.0_102
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
The handling of the callback to this child_process.exec always triggered an error if err was non null:
if (err) d.reject(new CordovaError(errMsg));
changing this to only trigger this error if the catchStderr flag was not set now correctly handles the test for javac:
if (err && !catchStderr) d.reject(new CordovaError(errMsg));
and now success:
sh-3.2# cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-9,android-10,android-16,android-18,android-19,android-22,android-23,android-24,Google Inc.:Google APIs:16,Google Inc.:Google APIs:18,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
Unfortunately need to edit check_reqs.js for each project when you cordova platform add android but at least it's now finding everything.
Everything worked perfectly when I did the installation with Cordova version 7 and JDK 1.8u131 on OSX. Nothing had to be changed or configured. Possibly the older versions of Cordova had issues.

Intellij complains tools.jar not in classpath even though JDK is set up

In my ubuntu installation the JAVA_HOME is setup properly:
ubuntu#SB-Ubuntu:~$ echo $JAVA_HOME
/shared/jdk1.7.0_79
ubuntu#SB-Ubuntu:~$ which javac
/shared/jdk1.7.0_79/bin/javac
And the tools.jar is available:
ll $JAVA_HOME/lib/tools.jar
-rw-r--r-- 1 ubuntu ubuntu 15256650 Apr 10 2015 /shared/jdk1.7.0_79/lib/tools.jar
So then why is the following error occurring?
Installing openjdk-7 via apt-get solved the problem.
sudo apt-get install openjdk-7-jdk
It was not necessary to reboot or even to logout.

Maven with Ant wrapper error - main class path

I'm attempting to compile my companies codebase using Maven which is wrapped in an Ant launcher for backwards compatibility reasons. I am running Oracle Linux 6.6, Java 1.7 u79-b14, Ant 1.7.1 and Maven 3.0.5 which are versions dictated to me by the enterprise infrastructure team.
When I set JAVA_HOME I get the following error when executing Ant Error: Could not find or load main class org.apache.tools.ant.launch.Launcher but if JAVA_HOME is commented out then Ant seems to run just fine.
#~/.bashrc
export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
export MAVEN_HOME=/usr/share/maven
export M2_HOME=/usr/share/maven
export MAVEN_OPTS="-Xmx1024m"
export BUILD_CHROOT="/home/builduser/builds"
Included to help is the location at which Java is installed.
[builduser#iaas-a-jen03 ~]$ which java
/usr/bin/java
[builduser#iaas-a-jen03 ~]$ ls -la /usr/bin/java
lrwxrwxrwx 1 root root 22 Jun 30 11:58 /usr/bin/java -> /etc/alternatives/java
[builduser#iaas-a-jen03 ~]$ ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Jun 30 11:58 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
The issue was resolved by following the steps found in this blog post... http://pkolomeitsev.blogspot.co.uk/2015/01/apache-ant-error-could-not-find-or-load.html
ant --execdebug was the key to creating the right folders. Then I just had to make sure that java-1.7.0-openjdk-devel.x86_46 was installed and voila!

java_home not found on osx mavericks

Can anyone help me figure out why every command I execute involving
JAVA_HOME
results in
-bash: /usr/libexec/java_home: No such file or directory
interestingly when i do an ls -al of /usr/libexec/java_home is listed as
lrwxr-xr-x 1 root wheel
79 Apr 10 13:15 java_home -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home
I am unable to run any java based programs because JDK isn't working.

Categories