This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 59b059c098 Ensure tomcat-jni.jar is not required by catalina.jar
59b059c098 is described below
commit 59b059c09802c4ea8359168abef9f09e796c6822
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 24 17:12:37 2025 +0000
Ensure tomcat-jni.jar is not required by catalina.jar
---
java/org/apache/catalina/connector/Connector.java | 18 +++++++++++++++++-
webapps/docs/changelog.xml | 5 +++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/connector/Connector.java
b/java/org/apache/catalina/connector/Connector.java
index e0d0dbe1f0..a10ed79e36 100644
--- a/java/org/apache/catalina/connector/Connector.java
+++ b/java/org/apache/catalina/connector/Connector.java
@@ -71,6 +71,22 @@ public class Connector extends LifecycleMBeanBase {
public static final String INTERNAL_EXECUTOR_NAME = "Internal";
+ private static final boolean aprStatusPresent;
+
+ static {
+ /*
+ * The AprStatus class has to be in the org.apache.tomcat.jni package
so it can be referenced by the OpenSSL
+ * clean-up code to avoid a race condition on shutdown between the
AprLifecycleListener shutting down the Tomcat
+ * Native library along with any remaining open connections and the
OpenSSL clean-up code shutting down an
+ * individual connection that can trigger a JVM crash.
+ *
+ * In some deployment scenarios AprStatus is not present - e.g.
because tomcat-jni.jar is not present. To avoid
+ * a CNFE in this class on Connector initialisation when AprStatus is
not present - and ugly work-arounds that
+ * try loading the class and catching the exception - use
getResource() to see if AprStatus is present.
+ */
+ aprStatusPresent =
+
(Connector.class.getClassLoader().getResource("org/apache/tomcat/jni/AprStatus.class")
!= null);
+ }
// ------------------------------------------------------------ Constructor
@@ -1053,7 +1069,7 @@ public class Connector extends LifecycleMBeanBase {
jsseProtocolHandler.setSslImplementationName(
"org.apache.tomcat.util.net.openssl.panama.OpenSSLImplementation");
}
- } else if (AprStatus.isAprAvailable() && AprStatus.getUseOpenSSL()
&&
+ } else if (aprStatusPresent && AprStatus.isAprAvailable() &&
AprStatus.getUseOpenSSL() &&
protocolHandler instanceof AbstractHttp11Protocol) {
// Use tomcat-native and OpenSSL otherwise, if available
AbstractHttp11JsseProtocol<?> jsseProtocolHandler =
(AbstractHttp11JsseProtocol<?>) protocolHandler;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2413921281..cf31ace818 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -115,6 +115,11 @@
Add log warnings for additional Host <code>appBase</code> suspicious
values. (remm)
</fix>
+ <fix>
+ Remove hard dependency on tomcat-jni.jar for catalina.jar.
+ <code>org.apache.catalina.Connector</code> no longer requires
+ <code>org.apache.tomcat.jni.AprStatus</code> to be present. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]