diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnSslEngine.java index 012b1676bf..6cfacb8b80 100644 --- a/handler/src/main/java/io/netty/handler/ssl/JdkAlpnSslEngine.java +++ b/handler/src/main/java/io/netty/handler/ssl/JdkAlpnSslEngine.java @@ -44,14 +44,8 @@ final class JdkAlpnSslEngine extends JdkSslEngine { } try { - // Try to get the bootstrap class loader. - ClassLoader bootloader = ClassLoader.getSystemClassLoader().getParent(); - if (bootloader == null) { - // If failed, use the system class loader, - // although it's not perfect to tell if APLN extension has been loaded. - bootloader = ClassLoader.getSystemClassLoader(); - } - Class.forName("sun.security.ssl.ALPNExtension", true, bootloader); + // Always use bootstrap class loader. + Class.forName("sun.security.ssl.ALPNExtension", true, null); available = true; } catch (Exception ignore) { // alpn-boot was not loaded. diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkNpnSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/JdkNpnSslEngine.java index 43d5bb584f..422727aa6e 100644 --- a/handler/src/main/java/io/netty/handler/ssl/JdkNpnSslEngine.java +++ b/handler/src/main/java/io/netty/handler/ssl/JdkNpnSslEngine.java @@ -44,14 +44,8 @@ final class JdkNpnSslEngine extends JdkSslEngine { return; } try { - // Try to get the bootstrap class loader. - ClassLoader bootloader = ClassLoader.getSystemClassLoader().getParent(); - if (bootloader == null) { - // If failed, use the system class loader, - // although it's not perfect to tell if NPN extension has been loaded. - bootloader = ClassLoader.getSystemClassLoader(); - } - Class.forName("sun.security.ssl.NextProtoNegoExtension", true, bootloader); + // Always use bootstrap class loader. + Class.forName("sun.security.ssl.NextProtoNegoExtension", true, null); available = true; } catch (Exception ignore) { // npn-boot was not loaded.