Tomcat native libraries

From OpenKM Documentation
Revision as of 11:03, 3 September 2012 by Pavila (talk | contribs) (Install on Linux)

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 libapr1 libaprutil1 libapr1-dev libssl-dev make

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
  • Ensure that the native library is in a location where Tomcat can find it:
 $ ln -s /usr/local/apr/lib/libtcnative-1.so /usr/lib/libtcnative-1.so
  • 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.120

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