Tomcat logs that the native library for OpenSSL was not found
The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.pathShort answer
This line is a notice, not a crash. Tomcat looks for the optional Tomcat Native library to use OpenSSL for TLS, and when it is missing it falls back to the JVM's own TLS (JSSE). If you want OpenSSL, build or install libtcnative, put it on the library path, and keep the AprLifecycleListener in server.xml.
Fix it fast
1Find out which cause you have
Look in catalina.out (or the service journal) for the startup lines about the native library. A working setup prints a 'Loaded Apache Tomcat Native library' line and an OpenSSL initialised line.
grep -n -i -E 'native library|openssl' $CATALINA_BASE/logs/catalina.out2Match what you see, then jump to its fix
- 1
The 'was not found' message and nothing about a loaded libraryThe native library was never installedFix - 2
libtcnative is on disk, yet the message still appearsThe library exists but the JVM cannot find itFix - 3
The library is installed and on the path, but nothing is loaded at startupThe listener that loads the library is missing from server.xmlFix - 4
HTTPS already works and only the message bothers youYou do not need OpenSSL at allFix
- 1
What does the error look like?
The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path
Cause 1 of 4
The native library was never installed
1Check
Tomcat Native is optional and is not part of the Tomcat download. Look for the library file in Tomcat's lib folder or the system library folders.
find $CATALINA_HOME/lib /usr/lib /usr/local -name 'libtcnative*' 2>/dev/null2Fix
Install what is needed to build it (the APR library, OpenSSL libraries and a JDK), then build it from the Tomcat Native source distribution. The libraries are installed into $CATALINA_HOME/lib.
sudo apt-get install libapr1-dev libssl-dev
# inside the native/ folder of the tomcat-native source
./configure --with-java-home=$JAVA_HOME --prefix=$CATALINA_HOME
make && make install3Verify
Restart Tomcat and read the startup lines again.
$CATALINA_HOME/bin/shutdown.sh; $CATALINA_HOME/bin/startup.sh
grep -n -i 'native library' $CATALINA_BASE/logs/catalina.outConfirmed by tomcat.apache.org
Cause 2 of 4
The library exists but the JVM cannot find it
1Check
The JVM only searches its library path. On Linux the build puts the files in $CATALINA_HOME/lib, which is not on it unless you add it.
echo $LD_LIBRARY_PATH2Fix
Add the folder to the library path in $CATALINA_HOME/bin/setenv.sh, so every start picks it up.
# $CATALINA_HOME/bin/setenv.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib3Verify
Restart and look for the 'Loaded Apache Tomcat Native library' line.
grep -n 'Loaded Apache Tomcat Native' $CATALINA_BASE/logs/catalina.outConfirmed by tomcat.apache.org
Cause 3 of 4
The listener that loads the library is missing from server.xml
1Check
Tomcat loads the native library through AprLifecycleListener. It is enabled by default, but an edited server.xml may have lost it or commented it out.
grep -n 'AprLifecycleListener' $CATALINA_BASE/conf/server.xml2Fix
Make sure this line is present and not commented out.
<Listener className="org.apache.catalina.core.AprLifecycleListener" />3Verify
Restart and check the startup log.
grep -n -i openssl $CATALINA_BASE/logs/catalina.outConfirmed by tomcat.apache.org
Cause 4 of 4
You do not need OpenSSL at all
1Check
Without the native library the connector uses org.apache.tomcat.util.net.jsse.JSSEImplementation, which wraps the JVM's own TLS. That is a supported, working setup.
curl -vkI https://localhost:8443 2>&1 | grep -i -E 'SSL connection|TLS'2Fix
Leave things as they are. Note that if you do install the native library, the connectors switch to OpenSSL by default, so retest your certificates (use either Java keystore attributes or PEM attributes on a connector, not both).
# nothing to change; to name the implementation explicitly
# <Connector ... sslImplementationName="org.apache.tomcat.util.net.jsse.JSSEImplementation">3Verify
HTTPS answers on the connector port.
curl -kI https://localhost:8443Confirmed by tomcat.apache.org
How do I stop it coming back?
- Decide once whether the server uses JSSE or OpenSSL, and write it in your setup notes.
- Put the library path in setenv.sh and not in a login shell profile, which a service manager does not read.
- After a Tomcat or JDK upgrade, check the startup log for this line and the 'Loaded' line.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
Java or NetBeans fails because libXtst.so.6 is missing on Ubuntu
Can't find/install libXtst.so.6
libXtst.so.6 comes from the Ubuntu package libxtst6, and a Java desktop program needs it to load.
2 causes, each with a fixServers
Testcontainers (Java) fails with 'docker-machine executable was not found on PATH'
docker-machine executable was not found on PATH
This message is the last step of a search.
3 causes, each with a fixServers
dnf cannot install MySQL on Amazon Linux 2023
dnf cannot find a mysql-server package on Amazon Linux 2023
Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.
3 causes, each with a fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fix