{"record":{"id":"8707d4f918ab8e04","repo":"pinpoint-apm/pinpoint","slug":"bootstrapclassloader-access-fail-caused-by","errorCode":null,"errorMessage":"bootstrapClassLoader access fail Caused by:","messagePattern":"bootstrapClassLoader access fail Caused by:","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/classloader/J9BootLoader.java","lineNumber":59,"sourceCode":"        findResources = getMethod(abstractClassLoader, \"findResources\", String.class);\n    }\n\n    private static ClassLoader findBootstrapClassLoader() {\n        Field bootstrapClassLoader;\n        try {\n            bootstrapClassLoader = ClassLoader.class.getDeclaredField(\"bootstrapClassLoader\");\n        } catch (NoSuchFieldException e) {\n            try {\n                bootstrapClassLoader = ClassLoader.class.getDeclaredField(\"systemClassLoader\");\n            } catch (NoSuchFieldException e2) {\n                throw new IllegalStateException(\"bootstrapClassLoader not found Caused by:\" + e.getMessage() + \", and \" + e2.getMessage(), e2);\n            }\n        }\n        try {\n            bootstrapClassLoader.setAccessible(true);\n            return (ClassLoader) bootstrapClassLoader.get(ClassLoader.class);\n        } catch (IllegalAccessException e) {\n            throw new IllegalStateException(\"bootstrapClassLoader access fail Caused by:\" + e.getMessage(), e);\n        }\n    }\n\n    private static Class<?> getAbstractClassLoader(String className) {\n        try {\n            return Class.forName(className, false, Object.class.getClassLoader());\n        } catch (ClassNotFoundException e) {\n            throw new IllegalStateException(className + \" not found Caused by:\" + e.getMessage(), e);\n        }\n    }\n\n\n    private static Method getMethod(Class<?> bootstrapClassLoader, String methodName, Class<?>... parameterTypes) {\n        try {\n            Method declaredMethod = bootstrapClassLoader.getDeclaredMethod(methodName, parameterTypes);\n            declaredMethod.setAccessible(true);\n            return declaredMethod;\n        } catch (NoSuchMethodException e) {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/classloader/J9BootLoader.java#L41-L77","documentation":"After locating the bootstrap classloader Field, J9BootLoader calls setAccessible(true) and Field.get. An IllegalAccessException here (field not accessible due to access restrictions/module rules) is wrapped as IllegalStateException 'bootstrapClassLoader access fail Caused by:...'.","triggerScenarios":"JVM module system (JPMS) or a SecurityManager denies reflective access to the ClassLoader internal field when findBootstrapClassLoader completes its get() call.","commonSituations":"Java 9+ strong encapsulation blocking setAccessible on java.lang internals, SecurityManager policy without ReflectPermission, or J9 restrictions differing from HotSpot.","solutions":["Add JVM flags to permit deep reflection (--add-opens java.base/java.lang=ALL-UNNAMED)","Run on the JDK version the agent supports (typically Java 8 for this code path)","Grant ReflectPermission/suppressSecurityManager if one is installed","Read the Caused-by to confirm access vs presence of the field"],"exampleFix":"// before\njava -javaagent:pinpoint-bootstrap.jar ...\n// after (Java 9+)\njava --add-opens java.base/java.lang=ALL-UNNAMED -javaagent:pinpoint-bootstrap.jar ...","handlingStrategy":"try-catch","validationCode":"// JPMS check before reflective access\nModule module = ClassLoader.class.getModule();\nif (!module.isOpen(\"java.lang\", J9BootLoader.class.getClassLoader().getModule == null ? null : J9BootLoader.class.getClassLoader().getModule())) {\n  throw new IllegalStateException(\"Add --add-opens java.base/java.lang=ALL-UNNAMED\");\n}","typeGuard":null,"tryCatchPattern":"try { ClassLoader bcl = j9BootLoader.getBootstrap(); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"bootstrapClassLoader access fail\")) { log.error(\"Grant access: --add-opens java.base/java.lang=ALL-UNNAMED\"); } throw e; }","preventionTips":["Launch with --add-opens java.base/java.lang=ALL-UNNAMED on Java 9+","Avoid SecurityManager configurations without ReflectPermission","Prefer Java 8 for agents that rely on deep reflection","Test attach under the exact JVM flags used in production"],"tags":["java","reflection","accessibility"],"backgroundTag":"permission-denied","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}