This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new ee11047fdd Nicer error message when not using Java 22 ee11047fdd is described below commit ee11047fdd8a564973f777ded029d79af2316d5a Author: remm <r...@apache.org> AuthorDate: Wed Oct 18 16:08:00 2023 +0200 Nicer error message when not using Java 22 --- .../tomcat/util/net/openssl/panama/OpenSSLLifecycleListener.java | 8 ++++++++ .../apache/tomcat/util/net/openssl/panama/LocalStrings.properties | 1 + 2 files changed, 9 insertions(+) diff --git a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLifecycleListener.java b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLifecycleListener.java index dd43b456f2..2e92f01b74 100644 --- a/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLifecycleListener.java +++ b/modules/openssl-foreign/src/main/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLifecycleListener.java @@ -24,6 +24,7 @@ import org.apache.catalina.Server; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.ExceptionUtils; +import org.apache.tomcat.util.compat.JreCompat; import org.apache.tomcat.util.res.StringManager; @@ -61,6 +62,10 @@ public class OpenSSLLifecycleListener implements LifecycleListener { log.warn(sm.getString("listener.notServer", event.getLifecycle().getClass().getSimpleName())); } + if (!JreCompat.isJre22Available()) { + log.warn(sm.getString("openssllistener.java22")); + return; + } try { OpenSSLLibrary.init(); } catch (Throwable t) { @@ -79,6 +84,9 @@ public class OpenSSLLifecycleListener implements LifecycleListener { } } if (initError || Lifecycle.AFTER_DESTROY_EVENT.equals(event.getType())) { + if (!JreCompat.isJre22Available()) { + return; + } // Note: Without the listener, destroy will never be called (which is not a significant problem) try { OpenSSLLibrary.destroy(); diff --git a/modules/openssl-foreign/src/main/resources/org/apache/tomcat/util/net/openssl/panama/LocalStrings.properties b/modules/openssl-foreign/src/main/resources/org/apache/tomcat/util/net/openssl/panama/LocalStrings.properties index f1bff0a31a..e3a4aebafa 100644 --- a/modules/openssl-foreign/src/main/resources/org/apache/tomcat/util/net/openssl/panama/LocalStrings.properties +++ b/modules/openssl-foreign/src/main/resources/org/apache/tomcat/util/net/openssl/panama/LocalStrings.properties @@ -82,6 +82,7 @@ sessionContext.nullTicketKeys=Null keys openssllistener.destroy=Failed shutdown of OpenSSL openssllistener.initializeFIPSFailed=Failed to enter FIPS mode +openssllistener.java22=Tomcat OpenSSL support requires the FFM API which is available in Java 22 and newer, tomcat-native should be used instead openssllistener.sslInit=Failed to initialize the SSLEngine. openssllibrary.ciphersFailure=Failed getting cipher list --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org