"superclass access check failed" Class Load Error

This section provides a tutorial example of 'superclass access check failed' class load error.

Sometimes loading a class may fail because of access restrictions. Here is an example of loading "com.sun.deploy.net.protocol.https.Handler" class from the JDK deploy.jar library.

C:\herong>java ClassChecker com.sun.deploy.net.protocol.https.Handler

Exception in thread "main" java.lang.IllegalAccessError: 
   superclass access check failed: 
   class com.sun.deploy.net.protocol.https.Handler (in module jdk.deploy) 
   cannot access class sun.net.www.protocol.https.Handler (in module java.base) 
   because module java.base does not export sun.net.www.protocol.https 
   to module jdk.deploy
at java.base/java.lang.ClassLoader.defineClass2(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(UnknownSource)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at ClassChecker.main(ClassChecker.java:15)

HotSpot JVM started this type of "superclass access check" from JDK 1.8.

Last update: 2018.

Table of Contents

 About This Book

 JVM (Java Virtual Machine) Specification

 Java HotSpot VM - JVM by Oracle/Sun

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

ClassLoader Class - Class Loaders

 What Is Class Loader

 What Is java.lang.ClassLoader Class

 Accessing the ClassLoader of a Class

 JVM "-verbose:class" Option

 loadClass() Method - Loading Classes Explicitly

 getSystemResource() Method - Finding Files

 Class Loading Problem - JAR Hell

 ClassChecker.java - Reports Class Loader

 ClassChecker.java - Reports Class Locations

"superclass access check failed" Class Load Error

 Class Loading Followed by Class Initialization

 Class Class - Class Reflections

 JVM Runtime Data Areas

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 JRockit JVM 28.2.7 by Oracle Corporation

 Outdated Tutorials


 Full Version in PDF/EPUB