Tomcat native libraries

From OpenKM Documentation
Jump to: navigation, search

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

These features allows making Tomcat a general purpose webserver, will enable much better integration with other native web technologies, and overall make Java much more viable as a full fledged webserver platform rather than simply a backend focused technology.

Install on Linux

To follow these steps you need to be root.

  • Install the APR itself, along with development packages that will be use by the build for the native wrappers:

Ubuntu / Debian

 $ aptitude install build-essential libapr1 libaprutil1 libapr1-dev libssl-dev

RedHat / CentOS

 $ yum install apr-devel openssl-devel make
  • Untar the native wrappers archive that's shipped with Tomcat:
 $ cd $TOMCAT_HOME/bin
 $ tar zxvf tomcat-native.tar.gz
  • Build and install the native wrappers:
 $ cd tomcat-native*/jni/native
 $ ./configure --with-apr=/usr/bin/apr-1-config --with-java-home=/usr/lib/jvm/java-6-sun
 $ make
 $ make install
  • Modify $TOMCAT_HOME/bin/ script to include this library path:
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib/sigar:/usr/local/apr/lib
  • Re-start Tomcat and then look in the log: you should see a message like:
 INFO: Loaded APR based Apache Tomcat Native Library 1.1.23

See also Apache Portable Runtime (APR) based Native library for Tomcat.