From 09738d3966a52505bf08eb1222a393243aebeb59 Mon Sep 17 00:00:00 2001 From: Grzegorz Grzybek Date: Thu, 23 Mar 2023 15:12:37 +0100 Subject: [PATCH] [tests] Prevent Tomcat Illegal reflective access for java.lang.Thread.threadLocals --- .../pax/web/service/tomcat/internal/PaxWebStandardContext.java | 1 + .../pax/web/service/tomcat/internal/TomcatServerWrapper.java | 1 + 2 files changed, 2 insertions(+) diff --git a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/PaxWebStandardContext.java b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/PaxWebStandardContext.java index 5ed917513f..d3c1110351 100644 --- a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/PaxWebStandardContext.java +++ b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/PaxWebStandardContext.java @@ -129,6 +129,7 @@ public PaxWebStandardContext(Default404Servlet defaultServlet, OsgiSessionAttrib this.osgiSessionsBridge = osgiSessionsBridge; this.setClearReferencesObjectStreamClassCaches(false); this.setClearReferencesRmiTargets(false); + this.setClearReferencesThreadLocals(false); } /** diff --git a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatServerWrapper.java b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatServerWrapper.java index 893469b5cb..69c79cb414 100644 --- a/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatServerWrapper.java +++ b/pax-web-tomcat/src/main/java/org/ops4j/pax/web/service/tomcat/internal/TomcatServerWrapper.java @@ -2073,6 +2073,7 @@ private void ensureServletContextStarted(PaxWebStandardContext context) { ParallelWebappClassLoader loaderInstance = new ParallelWebappClassLoader(highestRankedContext.getClassLoader()); loaderInstance.setClearReferencesObjectStreamClassCaches(false); loaderInstance.setClearReferencesRmiTargets(false); + loaderInstance.setClearReferencesThreadLocals(false); tomcatLoader.setLoaderInstance(loaderInstance); context.setParentClassLoader(highestRankedContext.getClassLoader()); context.setLoader(tomcatLoader);