tomcathttps

Launching https on Tomcat Port 8443 - requires the APR/native library which is not available


I need advice on https. Below is the configuration of the server.xml file

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               maxParameterCount="1000"
               redirectPort="8443" />
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               maxParameterCount="1000"
               <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
                  <SSLHostConfig>               
                      <Certificate 
                      certificateKeyFile="conf/privateKey.pem"
                      certificateFile="conf/certificateCA.crt"
                      certificateChainFile="conf/certificate.crt"
                      type="RSA" />
                  </SSLHostConfig>

However, this configuration does not run the mi server on port 8443. No listening on port 8443. It only works on port 8080.

The following message appears in the Tomcat logs:

15-Jul-2024 13:53:17.390 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 15-Jul-2024 13:53:17.406 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]] org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available at org.apache.catalina.connector.Connector.initInternal

How do I fix this?


Solution

  • The fix on TC9 and Windows is to install the APR in accordance with this.

    Download the zipped TCL for Windows here.

    Unzip it.

    Copy the file at tomcat-native-1.3.0-openssl-3.0.13-win32-bin.zip\bin\x64\tcnative-1.dll into the java bin folder used by Tomcat, ie %JRE_HOME%/bin. You can also drop it in C:\Windows\System32 if you can't locate the java bin location.

    Start Tomcat. You should see the following in the logs and HTTPS being served on port 8443.

     OpenSSL successfully initialized