{"record":{"id":"ad81c0faa322152e","repo":"pinpoint-apm/pinpoint","slug":"bootstrapclassloader-not-found-caused-by","errorCode":null,"errorMessage":"bootstrapClassLoader not found Caused by:","messagePattern":"bootstrapClassLoader not found 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":52,"sourceCode":"    private static final Method findResource;\n    private static final Method findResources;\n\n    static {\n        bootstrapClassLoader = findBootstrapClassLoader();\n        final Class<?> abstractClassLoader = getAbstractClassLoader(\"com.ibm.oti.vm.AbstractClassLoader\");\n        findResource = getMethod(abstractClassLoader, \"findResource\", String.class);\n        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","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/classloader/J9BootLoader.java#L34-L70","documentation":"J9BootLoader.locateBootstrapClassLoader reflectively fetches the JVM's bootstrap classloader field. It tries field 'bootstrapClassLoader' then falls back to 'systemClassLoader'; if neither exists on ClassLoader it throws IllegalStateException 'bootstrapClassLoader not found Caused by:...'.","triggerScenarios":"Running on a JVM whose ClassLoader class has neither internal field (e.g. newer OpenJ9/HotSpot where the J9-specific field name changed), while J9BootLoader is being constructed.","commonSituations":"JVM version upgrade renamed internal fields, agent accidentally running under J9BootLoader on a non-J9 VM due to misdetected VM name, modular JDK restricting internal field access.","solutions":["Verify VM detection so this loader only runs on supported J9 VMs","Upgrade/downgrade the JVM to a version whose ClassLoader has the expected field","Use LauncherBootLoader/standard path instead of J9 reflection","Check the Caused-by messages ('...and ...') to see which field lookups failed"],"exampleFix":"// before\n// agent started with -Dpinpoint.profiler.bootstrap... on OpenJ9 0.40, expecting field 'bootstrapClassLoader'\n// after\n// run on supported IBM J9 Java 8, or configure factory to use LauncherBootLoader","handlingStrategy":"try-catch","validationCode":"// ensure this loader is only used on supported J9 VMs\nString vm = System.getProperty(\"java.vm.name\", \"\");\nif (!vm.contains(\"J9\")) throw new IllegalStateException(\"J9BootLoader requires an IBM J9 VM, got: \" + vm);","typeGuard":null,"tryCatchPattern":"try { bootLoader = J9BootLoader.create(); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"bootstrapClassLoader not found\")) { bootLoader = new LauncherBootLoader(); } else throw e; }","preventionTips":["Run the agent on the JDK versions the agent officially supports","Fix VM-name detection so non-J9 VMs never take the J9 path","Verify internal field names after any JVM upgrade","Add a startup self-check that logs the JVM vendor/version with the agent"],"tags":["java","classloader","reflection","j9"],"backgroundTag":"internal-invariant-violation","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"}