What does “APR-based Tomcat Native Library Not Found” mean?

I am using Tomcat 7 in Eclipse on Windows. When I start Tomcat, I get the following informational message:

APR-based Apache Tomcat Native library that provides optimal performance in production environments not found on java.library.path

What does this mean and how can I provide the APR library?

+90
eclipse tomcat apr
Jan 03 '12 at 17:33
source share
10 answers

This means exactly what he says: "The ApR-based Apache Tomcat Native library, which provides optimal performance in production environments, was not found on java.library.path"

The referenced library is inserted into the OS-specific dll (tcnative-1.dll) loaded through the JNI. This allows tomcat to use OS functionality that is not provided for in the Java Runtime (such as sendfile, epoll, OpenSSL, system state, etc.). Tomcat will work fine, but in some cases it will be faster with native libraries.

If you really want to, download tcnative-1.dll (or libtcnative.so for Linux) and put it in the bin folder and add the system property to the tomcat server startup configuration in eclipse.

  -Djava.library.path=c:\dev\tomcat\bin 
+107
Jan 03 2018-12-12T00:
source share

If you are not working with a production server, do not worry about this message. This is a library that is used to increase productivity (in production systems). From the Apache Portable Runtime (APR) based on the Native library for Tomcat :

Tomcat can use the Apache Portable Runtime to provide superior scalability, performance and better integration with its own server technology. Apache Portable Runtime is a very portable library that underlies Apache HTTP Server 2.x. APR has many uses, including access to advanced I / O functionality (for example, sendfile, epoll and OpenSSL), OS level functionality (random number generation, status system, etc.) and native process processing (shared memory, NT- channels and Unix).

+30
Jan 03 '12 at 19:21
source share

On RHEL Linux, simply output:

 yum install tomcat-native.x86_64 

/ Note: depending on your architecture, a 64-bit or 32-bit package may have a different extension /

It's all. After that, you will find the following informational message in the log file:

 INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 

All operations will be noticeably faster than before.

+24
Nov 15 '13 at 16:02
source share

Installing your own library on an Ubuntu server using:

 sudo apt-get install libtcnative-1 

If this does not work, then tomcat-native must be installed

+21
Dec 15 '13 at 22:36
source share

I just went through this and configured it as follows:

Ubuntu 16.04

Tomcat 8.5.9

Apache2.4.25

Apr 1.5.2

Tomcat-native 1.2.10

Java 8

Here are the steps I used based on old posts here:

Install package

 sudo apt-get update sudo apt-get install libtcnative-1 

Make sure 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 

check 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 

check out 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 file /opt/tomcat/bin/setenv.sh with the following line:

 sudo pico /opt/tomcat/bin/setenv.sh export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib' 

restart the cat

sudo service tomcat restart

+8
Dec 22 '16 at 20:26
source share

on debian 8 I fix it when installing libapr1-dev :

 apt-get install libtcnative-1 libapr1-dev 
+5
Sep 17 '16 at 11:17
source share

There was this problem. If you have libraries but still have this error, it could be a configuration error. Your server.xml may not be on the following line:

  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> 

(Alternatively, it can be commented). This <Listener> , like other listeners, is a top-level child of the <Server> .

Without the <Listener> there is no attempt to load the APR library, therefore the LD_LIBRARY_PATH and -Djava.library.path= parameters are ignored.

+5
Feb 07 '17 at 15:02
source share

I had the same problem when tomasat could not find the class. Try viewing other log files. Sometimes in different log files the def class definition error is not detected:

  • tomcat8-STDOUT
  • tomcat8-STDERR
  • local
0
Jun 12 '15 at 6:01
source share

If you do not have the Tomcat Native library, install it with:

sudo apt-get install libtcnative-1

and if it is still there, the old version updates it with:

sudo apt-get upgrade libtcnative-1

0
Dec 22 '16 at
source share

I had this issue updating from Java 8 to 11 . After adding this dependency, my application started without problems:

 <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.25.0-GA</version> </dependency> 
0
Jun 03 '19 at 10:51 on
source share



All Articles