The Apache Portable Runtime (APR) and Tomcat Native Libraries are optional components that give Tomcat access to the Apache’s socket implementation and random number generator; both crucial for efficient SSL/TLS.

Installing the APR is relatively simple and should be seriously considered on any production Tomcat server.

  1. Downlaod, make and install the APR libraries.
  2. Download, make and install the Tomcat Native libraries.
  3. Configure Tomcat to use the new libraries.
  4. Tweak the server.xml file since the Connector attributes are slightly different.

Install APR Libraries

Installing the APR consists of downloading the source code, compiling and installing.

> wget
> tar -xzf apr-1.5.1.tar.gz
> cd ./apr-1.5.1
> sudo ./configure
> sudo make
> sudo make install

Install Tomcat Native Libraries

The process for installing the Tomcat libraries is almost identical, except we need to tell the configure script where:

  1. the APR libraries are installed,
  2. where Java is installed (JAVA_HOME) and,
  3. where Tomcat is installed (CATALINA_HOME).
> wget
> tar -xzf tomcat-native-1.1.31-src.tar.gz
> cd tomcat-native-1.1.31-src
> ./configure --with-apr=/usr/local/lib/apr/apr-1-config \
            --with-java-home=$JAVA_HOME \
            --with-ssl=yes \
> make
> make install

NOTE On my system (Ubuntu 12.04 LTS) the APR libraries were installed to /usr/local/lib/apr.

Export the Libraries

Edit (or create) $CATALINA_HOME/bin/ and add the following two lines:


Modify server.xml