Tomcat apr support

From snippet wiki
Jump to: navigation, search

Get the apr and apr-utils source packages from https://apr.apache.org/download.cgi and compile them

cd apr
./configure
make
make install

and

cd apr-utils
./configure --with-apr=/usr/local/apr/
make
make install

You need openssl 1.0.2 or greater. Your distribution might be stuck at 1.0.1. So compile it yourself:

wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar xzf openssl-1.0.2-latest.tar.gz
cd openssl-1.0.2*
./config shared -O3 -fPIC -Wl,-rpath=/usr/local/ssl/lib
make
make test
make install

Now you can extract the tomcat-native.tar.gz from within /opt/tomcat/bin/ and jump into ints nativ subfolder. Arguments might be optional. Try first without them.

cd tomcat-native-1.2.10-src/native
./configure --with-apr=/usr/local/apr/ --with-java-home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64 --with-ssl=/usr/local/ssl
make
make install

You might have to add the path to the apr lib to the tomcat startup script:

Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.library.path=/usr/local/apr/lib'

Staring tomcat it should automatically use the apr connector. Just have a look in the catalina logfile.

INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.10 using APR version 1.5.2.
INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2j  26 Sep 2016)
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-81"]

Autoren der Seite / Contributors of the page

» Kai Kretschmann, (google+)