Tomcat apr support

From snippet wiki
Jump to navigation Jump to search

Get the apr and apr-utils source packages from and compile them

cd apr
make install


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

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

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 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- --with-ssl=/usr/local/ssl
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"]