Tomcat Native Libraries

The Tomcat Native Libraries improve the performance of Tomcat by leveraging the faster I/O capabilities of the operating system. This is a step-by-step procedure to install them with the least amount of difficulty. The native libraries will be built from source, so we need to make sure we have the required dependencies.

1. Install the following dependencies:

# yum install apr-devel gcc java-1.6.0-openjdk-devel openssl-devel

Alternately, you can use the Sun/Oracle JDK. In either case you will need to set the environment variable JAVA_HOME.
2. Download the latest native libraries from
3. Untar the source tarball

# tar -zxvf tomcat-native-1.1.24-src.tar.gz

4. Navigate inside the extracted tarball

cd tomcat-native-1.1.24-src/jni/native

5. Configure the package for your host

# ./configure \
--prefix=/usr/local/tomcat-native \
--with-apr=/usr/bin/apr-1-config \

6. Make the package and install it

make && make install

If the make fails, it maybe because it cannot find your installation of java. If you used my java.profile (look in my github repo for tomcat), it should have set the necessary environment variable. If it did not, your java install maybe in a location that the profile script does not search. Update your copy of the java.profile to reflect your location and log out and back in to refresh your environment variables. If JAVA_HOME is set and make still complains, then JAVA_HOME maybe pointing at an incomplete installation.

Once the native libraries are installed, you can use the commented lines in my to enable the tomcat server to locate these libraries. A restart of your tomcat instance should pickup the changes and when you review catalina.out, you should see that the server identified the libraries and used them.

The reason I override the prefix, is to keep the tomcat install clean, you can upgrade the native libraries without touching the tomcat instance and vice-versa.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s