{"record":{"id":"aff9de1702b44eb3","repo":"oracle/graal","slug":"s-class-loading-not-supported-in-libgraal","errorCode":null,"errorMessage":"%s (class loading not supported in libgraal)","messagePattern":"(.+?) \\(class loading not supported in libgraal\\)","errorType":"exception","errorClass":"ClassNotFoundException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalSubstitutions.java","lineNumber":89,"sourceCode":"        /**\n         * Make package-private {@code clean()} accessible so that it can be called from\n         * {@link LibGraalSupportImpl#doReferenceHandling()}.\n         */\n        @Alias\n        public static native void clean();\n    }\n\n    /// Removes string-based class lookup from the libgraal runtime image. All compiler classes and\n    /// providers needed by libgraal are discovered while building the image, and libgraal does not\n    /// define or load new Java classes at runtime. Keeping these methods live would make the JDK\n    /// class-loading stack reachable, including resource lookup through class loaders, even though\n    /// that machinery cannot produce useful results for libgraal.\n    @TargetClass(value = java.lang.Class.class, onlyWith = LibGraalFeature.IsEnabled.class)\n    static final class Target_java_lang_Class {\n        @Substitute\n        public static Class<?> forName(String name, boolean initialize, ClassLoader loader)\n                        throws ClassNotFoundException {\n            throw new ClassNotFoundException(name + \" (class loading not supported in libgraal)\");\n        }\n\n        @Substitute\n        private static Class<?> forName(String className, Class<?> caller)\n                        throws ClassNotFoundException {\n            throw new ClassNotFoundException(className + \" (class loading not supported in libgraal)\");\n        }\n\n        @Substitute\n        public static Class<?> forName(Module module, String name) {\n            return null;\n        }\n    }\n\n    /// Cuts off runtime class loading and class-loader resource lookup. Libgraal runs from a closed\n    /// image heap with its providers and resources selected during image building, so runtime\n    /// classpath probing is dead code. Returning empty results here prevents the normal JDK class\n    /// loader implementation from making `URLClassPath`, `FileURLMapper`, jar handling, and jar","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalSubstitutions.java#L71-L107","documentation":"Error \"%s (class loading not supported in libgraal)\" thrown in oracle/graal.","triggerScenarios":"Thrown at compiler/src/jdk.graal.compiler.libgraal/src/jdk/graal/compiler/libgraal/LibGraalSubstitutions.java:89 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: {} (class loading not supported in libgraal)","solutions":["Fix the condition reported by the error: {} (class loading not supported in libgraal)","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: {} (class loading not supported in libgraal)","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}