score:131

Accepted answer

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

score:0

i had the same problem when tomсat could not find the class. try to view other log files. sometimes no class def found error appears in different log files:

  • tomcat8-stdout
  • tomcat8-stderr
  • localhost

score:0

if you don't have tomcat native library install it with:

sudo apt-get install libtcnative-1

and if it's still there an old version upgrade it with:

sudo apt-get upgrade libtcnative-1

score:0

my problem was in add some library from tomcat to eclipse class path i just going to eclipse click right to project and going to debug configuration -> classpath -> add external jars add all jars files from apache-tomcat-7.0.35\bin this was my problem and it's worked for me .
enter image description here

score:0

for future readers: i had faced this issue myself when trying to run a spring boot application in spring sts. this issue didn't resurface initially. i was able to work on my project without any issues for quite some time until one fine day i started getting this particular error.

from what i am able to recall i had not made any configuration changes to my project and neither changed the java/tomcat version being used.

none of the discussions/suggestions regarding installing the tomcat native library made any sense to me since the project was already working fine before.

solution that worked for me:

so lastly i though of trying to delete and reimport my project.

i deleted my project from spring sts, restarted the spring sts and then reimported the project. it worked like a charm and never faced the issue ever since.

you may also try deleting any ide generated files/folders(if there are any) in your project, before restarting the ide and reimporting the project.

i still happen to work on this project from time to time and haven't faced the issue as of now. my current development ide is intellij.

i'm not sure if the error was ide specific.

score:2

i had this issue upgrading from java 8 to 11. after adding this dependency, my app launched without issue:

<dependency>
    <groupid>org.javassist</groupid>
    <artifactid>javassist</artifactid>
    <version>3.25.0-ga</version>
</dependency>

score:5

had this problem as well. if you do have the libraries, but still have this error, it may be a configuration error. your server.xml may be missing the following line:

 <listener classname="org.apache.catalina.core.aprlifecyclelistener" sslengine="on" />

(alternatively, it may be commented out). this <listener>, like other listeners is a child of the top-level <server>.

without the <listener> line, there's no attempt to load the apr library, so ld_library_path and -djava.library.path= settings are ignored.

score:7

on debian 8 i fix it with installing libapr1-dev:

apt-get install libtcnative-1 libapr1-dev

score:8

on mac os x:

$ brew install tomcat-native
==> tomcat-native
in order for tomcat's apr lifecycle listener to find this library, you'll
need to add it to java.library.path. this can be done by adding this line
to $catalina_home/bin/setenv.sh

  catalina_opts="$catalina_opts -djava.library.path=/usr/local/opt/tomcat-native/lib"

if $catalina_home/bin/setenv.sh doesn't exist, create it and make it executable.

then add it to the eclipse's tomcat arguments (double-click server > open launch configuration > arguments tab > vm arguments)

-djava.library.path=/usr/local/opt/tomcat-native/lib

score:14

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

score:23

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

  1. 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
  2. install tomcat apr:

  3. install tomcat tomcat-native:

score:33

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.

score:34

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).


Related Query

More Query from same tag