What does "The APR based Apache Tomcat Native library was not found" mean?
It means exactly what it says: "The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path"
The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI. It allows tomcat to use OS functionalities not provided in the Java Runtime (such as sendfile, epoll, OpenSSL, system status, etc.). Tomcat will run just fine without it, but for some use cases, it will be faster with the native libraries.
If you really want it, download the tcnative-1.dll
(or libtcnative.so
for Linux) and put it in the bin folder, and add a system property to the launch configuration of the tomcat server in eclipse.
-Djava.library.path=c:\dev\tomcat\bin
On RHEL Linux just issue:
yum install tomcat-native.x86_64
/Note:depending on Your architecture 64bit or 32bit package may have different extension/
That is all. After that You will find in the log file next informational message:
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
All operations will be noticeably faster than before.
Unless you're running a production server, don't worry about this message. This is a library which is used to improve performance (on production systems). From Apache Portable Runtime (APR) based Native library for Tomcat:
Tomcat can use the Apache Portable Runtime to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL), OS level functionality (random number generation, system status, etc), and native process handling (shared memory, NT pipes and Unix sockets).
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 just went through this and configured it with the following:
Ubuntu 16.04
Tomcat 8.5.9
Apache2.4.25
APR 1.5.2
Tomcat-native 1.2.10
Java 8
These are the steps i used based on the older posts here:
Install package
sudo apt-get update
sudo apt-get install libtcnative-1
Verify these packages are installed
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install openssl
Install package
sudo apt-get install libssl-dev
Install and compile Apache APR
cd /opt/tomcat/bin
sudo wget http://apache.mirror.anlx.net//apr/apr-1.5.2.tar.gz
sudo tar -xzvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install
verify installation
cd /usr/local/apr/lib/
ls
you should see the compiled file as
libapr-1.la
Download and install Tomcat Native source package
cd /opt/tomcat/bin
sudo wget https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.10/source/tomcat-native-1.2.10-src.tar.gz
sudo tar -xzvf tomcat-native-1.2.10-src.tar.gz
cd tomcat-native-1.2.10-src/native
verify JAVA_HOME
sudo pico ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
source ~/.bashrc
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install
Edit the /opt/tomcat/bin/setenv.sh file with following line:
sudo pico /opt/tomcat/bin/setenv.sh
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
restart tomcat
sudo service tomcat restart