pinpoint-apm/pinpoint · error · IllegalStateException

bootstrapClassLoader not found Caused by:

Error message

bootstrapClassLoader not found Caused by:

What it means

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:...'.

Source

Thrown at agent-module/bootstraps/bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/classloader/J9BootLoader.java:52

    private static final Method findResource;
    private static final Method findResources;

    static {
        bootstrapClassLoader = findBootstrapClassLoader();
        final Class<?> abstractClassLoader = getAbstractClassLoader("com.ibm.oti.vm.AbstractClassLoader");
        findResource = getMethod(abstractClassLoader, "findResource", String.class);
        findResources = getMethod(abstractClassLoader, "findResources", String.class);
    }

    private static ClassLoader findBootstrapClassLoader() {
        Field bootstrapClassLoader;
        try {
            bootstrapClassLoader = ClassLoader.class.getDeclaredField("bootstrapClassLoader");
        } catch (NoSuchFieldException e) {
            try {
                bootstrapClassLoader = ClassLoader.class.getDeclaredField("systemClassLoader");
            } catch (NoSuchFieldException e2) {
                throw new IllegalStateException("bootstrapClassLoader not found Caused by:" + e.getMessage() + ", and " + e2.getMessage(), e2);
            }
        }
        try {
            bootstrapClassLoader.setAccessible(true);
            return (ClassLoader) bootstrapClassLoader.get(ClassLoader.class);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException("bootstrapClassLoader access fail Caused by:" + e.getMessage(), e);
        }
    }

    private static Class<?> getAbstractClassLoader(String className) {
        try {
            return Class.forName(className, false, Object.class.getClassLoader());
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException(className + " not found Caused by:" + e.getMessage(), e);
        }
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Verify VM detection so this loader only runs on supported J9 VMs
  2. Upgrade/downgrade the JVM to a version whose ClassLoader has the expected field
  3. Use LauncherBootLoader/standard path instead of J9 reflection
  4. Check the Caused-by messages ('...and ...') to see which field lookups failed

Example fix

// before
// agent started with -Dpinpoint.profiler.bootstrap... on OpenJ9 0.40, expecting field 'bootstrapClassLoader'
// after
// run on supported IBM J9 Java 8, or configure factory to use LauncherBootLoader
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure this loader is only used on supported J9 VMs
String vm = System.getProperty("java.vm.name", "");
if (!vm.contains("J9")) throw new IllegalStateException("J9BootLoader requires an IBM J9 VM, got: " + vm);

Try / catch

try { bootLoader = J9BootLoader.create(); } catch (IllegalStateException e) { if (e.getMessage().startsWith("bootstrapClassLoader not found")) { bootLoader = new LauncherBootLoader(); } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/ad81c0faa322152e. Report an issue: GitHub.