Neil Walker
Neil Walker

Reputation: 6868

The APR based Apache Tomcat Native library ... was not found (but I have it)

I'm running some software and getting the following error regarding apr not being found. I saw that it wasn't there, so went to the apr folder, ran ./configure and ./make and ./make install.

It created files in /usr/local/apr/lib.

I then created the folder mentioned in the Tomcat log:

/root/Kony/KonyServer/tomcat/instance1/bin/tomcat-native-1.1.29-src/jni/native/.libs

and copied the files in here:

-rwxrwxrwx. 1 10848 10848    8351 Apr 13 19:35 apr.exp
-rwxrwxrwx. 1 10848 10848 1352604 Apr 13 19:35 libapr-1.a
-rwxrwxrwx. 1 10848 10848     826 Apr 13 19:35 libapr-1.la
-rwxrwxrwx. 1 10848 10848  736579 Apr 13 19:35 libapr-1.so
-rwxrwxrwx. 1 10848 10848  736579 Apr 13 19:35 libapr-1.so.0
-rwxrwxrwx. 1 10848 10848  736579 Apr 13 19:35 libapr-1.so.0.4.5

I even gave them a 777 mask and the owner/group matches the parent. It still gives me the error below.

Apr 13, 2015 7:46:42 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: /root/Kony/KonyServer/tomcat/instance1/bin/tomcat-native-1.1.29-src/jni/native/.libs
Apr 13, 2015 7:46:43 PM org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8085]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8085]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:813)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)
Caused by: 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:972)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 12 more

Apr 13, 2015 7:46:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8010"]
Apr 13, 2015 7:46:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2752 ms
Apr 13, 2015 7:46:44 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 13, 2015 7:46:44 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat 7.0.x-dev
Apr 13, 2015 7:46:44 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /root/Kony/KonyServer/tomcat/instance1/conf/Catalina/localhost/admin.xml

Can anyone offer any help?

Upvotes: 3

Views: 14052

Answers (2)

Aloysio
Aloysio

Reputation: 1

On Oracle Linux 7, a sort of clone of RHEL7, I had to compile the libs AND copy them also in /usr/lib64 ...

Refer to http://tomcat.apache.org/native-doc/

Basically:

  1. install deps:
    yum install apr-devel openssl-devel
  1. Download and extract the latest file from http://tomcat.apache.org/native-doc/
  2. CD to where you extracted the file
    ./configure --with-apr=$HOME/APR \
        --with-java-home=$JAVA_HOME \
        --with-ssl=$HOME/OPENSSL \
        --prefix=$CATALINA_HOME
    make && make install
    cp -v /usr/share/tomcat/lib/libtcnative-1.* /lib64/
    systemctl restart tomcat 

DONE!! All I had to do is add the certificates in the entry in server.xml

Upvotes: 0

Nahuel
Nahuel

Reputation: 164

I had a similar problem working in Debian and I fixed it using:

apt-get install libtcnative-1 

and uncommenting APRLifecycleListener in server.xml.

Upvotes: 8

Related Questions