7

server.xml

<Connector port="8080" protocol="org.apache.coyote.http11.Http11AprProtocol"
           connectionTimeout="4000"
           redirectPort="8443" />

Tomcat log

Oct 12, 2016 3:11:41 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.27 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.32
Oct 12, 2016 3:11:41 PM org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8080]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:838)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:642)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:667)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
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

installed pakets

apr-1.3.9-5.el6_2.x86_64

tomcat-7.0.70-2.el6.noarch

openssl-1.0.1e-48.el6_8.3.x86_64

tomcat-native-1.1.34-1.el6.x86_64

java-1.8.0-openjdk-1.8.0.101-3.b13.el6_8.x86_64

OS: CentOS

How to fix this error?

  • Any reason why you don't update to CentOS 7.x? Then you can install Tomcat 7.0 and its dependencies out of the main repos. – Stephen C Oct 12 '16 at 13:04
  • it's in the error, `SEVERE: An incompatible version 1.1.27 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.32`. Try installing APR version 1.1.32 – djointster Oct 12 '16 at 13:06

2 Answers2

9

Try to upgrade your library. Run this code into terminal:

sudo apt-get upgrade libtcnative-1

It should solve the problem.

Dejan
  • 111
  • 1
  • 5
  • Add some explanation with answer for how this answer help OP in fixing current issue – ρяσѕρєя K Dec 22 '16 at 00:51
  • 1
    This is a text from question : "An incompatible version 1.1.27 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.32 Oct 12, 2016 3:11:41 PM org.apache.catalina.core.StandardService initInternal". And you should upgrade your Tomcat native library. That solves my problem – Dejan Dec 22 '16 at 08:04
  • Also do not forget to add `-Djava.library.path` to vm options when you want to start tomcat. In ubuntu 18 it is `-Djava.library.path=/usr/lib/x86_64-linux-gnu/` – Mohsen Dec 15 '19 at 07:08
1

In this case, APR library might have missing lib for ssl connector which is tc-native, fix as below:

        . yum install apr-devel openssl-devel
        . download into $CATALINA_HOME/conf/tomcatnative and unpack the file tomcat-native-1.2.23-src.tar.gz
        . goto /native and run a command, this is the syntax
            ./configure --with-apr=$HOME/APR \
                        --with-java-home=$JAVA_HOME \
                        --with-ssl=$HOME/OPENSSL \
                        --prefix=$CATALINA_HOME

            And this is the real command
            ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64 --with-ssl=/usr/bin --prefix=/opt/tomcat

        . then run 'make && make install'
            (should have 'done' in the result without errors)
            (generated libs of tcnative are found under $CATALINA_HOME/lib)

        . under server.xml make sure below line exists
            <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

        . Edit $CATALINA_HOME/bin/setenv.sh (creating the file if necessary) and add the path to the tc-native libraries to LD_LIBRARY_PATH
            'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib'
            'export LD_LIBRARY_PATH'

    - now start tomcat and test, the following should be seen in logs/catalina.out 
        09-Apr-2020 12:16:07.075 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.4.8].
        09-Apr-2020 12:16:07.075 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
        09-Apr-2020 12:16:07.075 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
        09-Apr-2020 12:16:07.089 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k-fips  26 Jan 2017]
        09-Apr-2020 12:16:11.235 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
        09-Apr-2020 12:16:11.702 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-openssl-apr-8443"]

        . then test https://ip:8443/tx, should be accessible
  • thanks @yazeed. I followed your steps and it worked fine. Only had to install apr libraries before: `sudo apt-get install libapr1-dev libaprutil1-dev` (Ubuntu 18) – Juan Nov 25 '20 at 17:30