javassltomcatssl-certificatetomcat8

Setting up SSL certificate: APR tomcat-native Library installed, but APR Connector does not initialize


I'm trying to setup HTTPS with the certificate, certificateKey and certificateChain files that I got from my CA. I've been trying to install them on an Apache 8.5 server, and, as per Apache's docs, I edited the server.xml file to contain the following:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/cert/private.key" certificateFile="conf/cert/certificate.crt" certificateChainFile="conf/cert/ca_bundle.crt" type="RSA" />
        </SSLHostConfig>
</Connector>

However, when I start Tomcat, I get the following error, even though I have already installed the APR tomcat native library:

org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/local/jdk1.8.0_131/jre/lib/amd64:/usr/local/jdk1.8.0_131/jre/lib/i386::/home/conecta/Documentos/apache-tomcat-8.5.32/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]

 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]]
(Stack trace ...)
Caused by: org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available

Here are my $CATALINA_HOME/lib folder's contents:

annotations-api.jar       catalina-tribes.jar  jaspic-api.jar    libtcnative-2.so.0      tomcat-dbcp.jar     tomcat-jni.jar
catalina-ant.jar          ecj-4.6.3.jar        jsp-api.jar       libtcnative-2.so.0.0.6  tomcat-i18n-es.jar  tomcat-util.jar
catalina-ha.jar           el-api.jar           libtcnative-2.a   servlet-api.jar         tomcat-i18n-fr.jar  tomcat-util-scan.jar
catalina.jar              jasper-el.jar        libtcnative-2.la  tomcat-api.jar          tomcat-i18n-ja.jar  tomcat-websocket.jar
catalina-storeconfig.jar  jasper.jar           libtcnative-2.so  tomcat-coyote.jar       tomcat-jdbc.jar     websocket-api.jar

(Also, I have updated LD_LIBRARY_PATH to contain the lib folder, within setenv.sh)

Any ideas on what could be going wrong?

I tried following this guide on intalling Tomcat's native library, which I expected would solve my issue, but it didn't.


Solution

  • For anyone that might have the same problem, I managed to solve the issue by reinstalling a bunch of things. It's been a while, but if I remember correctly, I reinstalled TomCat itself, the tomcat-native library and openSSL. I do not know which one of those actions did it, but afterwards it suddenly worked.