Installation of Apache Tomcat Native on Linux Ubuntu 12.04


Linux: Ubuntu 12.04 x64
Tomcat: 7.0.39
Tomcat Native: 1.1.27


I tried to install tomcat's native library in a standard way using apt-get

#sudo apt-get install libtcnative-1

But, I got error message on the startup of tomcat saying that:

Installed version 1.1.22 is not suitable and at least version 1.1.24 is needed.

The only way I found to solve this error was to compile sources of Tomcat Native into fresh Ubuntu.

Steps used:


1. Install compiler

#sudo apt-get install make
#sudo apt-get install gcc

2. Install openssl and development libraries

#sudo apt-get install openssl
#sudo apt-get install libssl-dev

3. Install APR package

APR package can be downloaded from http://apr.apache.org/

#tar -xzf apr-1.4.6.tar.gz
#cd apr-1.4.6/
#sudo ./configure
#sudo make
#sudo make install

You should see the compiled file in

/usr/local/apr/lib/libapr-1.a

4. Download, compile and install Tomcat Native source package tomcat-native-1.1.27-src.tar.gz

Download archive into /tmp folder, then:

#cd /tmp
#tar -xzf tomcat-native-1.1.27-src.tar.gz
#cd tomcat-native-1.1.27-src/jni/native
#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
#sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
#sudo make
#sudo make install

Now, compiled Tomcat Native library should be in /usr/local/apr/libtcnative-1.so.0.1.27 with a symbolic link file /usr/local/apr/@libtcnative-1.so


5. Create or edit the $CATALINA_HOME/bin/setenv.sh file with line:

export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'

6. Restart tomcat and enjoy the desired result:

May 05, 2013 9:18:26 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.27 using APR version 1.4.6.
May 05, 2013 9:18:26 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
May 05, 2013 9:18:26 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1 14 Mar 2012)
May 05, 2013 9:18:27 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]


IT / Coding / How-To


Other Topics