From d3ee9c6ca1ea668b0c1b35c2f4e4483aa9dfef9e Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Tue, 8 May 2018 10:11:13 -0500 Subject: [PATCH] HHH-10435 Create class loaders in a privileged block --- .../classloading/internal/ClassLoaderServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java index b271057160..fd4deff3f3 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java @@ -11,6 +11,8 @@ import java.io.InputStream; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -81,7 +83,11 @@ public class ClassLoaderServiceImpl implements ClassLoaderService { orderedClassLoaderSet.add( ClassLoaderServiceImpl.class.getClassLoader() ); // now build the aggregated class loader... - this.aggregatedClassLoader = new AggregatedClassLoader( orderedClassLoaderSet,lookupPrecedence ); + this.aggregatedClassLoader = AccessController.doPrivileged( new PrivilegedAction() { + public AggregatedClassLoader run() { + return new AggregatedClassLoader( orderedClassLoaderSet, lookupPrecedence ); + } + } ); } /**