pinpoint-apm/pinpoint · warning
Failed to load plugin resource as stream {} with classLoader
Error message
Failed to load plugin resource as stream {} with classLoader What it means
BootstrapClassLoaderHandler.getResourceAsStream tries to return the bytecode stream of a plugin class resource from the bootstrap classloader. If appendToBootstrapClassLoaderSearch or getResourceAsStream throws, the handler logs this warn and returns null instead of propagating. A null result means callers (e.g. bytecode reading) cannot obtain the plugin class resource.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/classloading/BootstrapClassLoaderHandler.java:93
// Reordering is not recommended.
this.injectedToRoot = true;
}
}
}
@Override
public InputStream getResourceAsStream(ClassLoader targetClassLoader, String internalName) {
try {
if (targetClassLoader == null) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
if (classLoader == null) {
return null;
}
appendToBootstrapClassLoaderSearch();
return classLoader.getResourceAsStream(internalName);
}
} catch (Exception e) {
logger.warn("Failed to load plugin resource as stream {} with classLoader", internalName, e);
return null;
}
logger.warn("Invalid bootstrap class loader. cl={}", targetClassLoader);
return null;
}
}View on GitHub (pinned to 744c3d3075)
Solutions
- Inspect the exception stack trace attached to this warn for the root cause.
- Verify the plugin jar is appended to the bootstrap classloader search before resource lookup.
- Check the internalName ends with .class and matches the packaged resource path.
- Ensure callers handle a null InputStream return value.
Example fix
// before
InputStream in = injector.getResourceAsStream(cl, internalName);
byte[] bytes = IOUtils.toByteArray(in); // NPE if null
// after
InputStream in = injector.getResourceAsStream(cl, internalName);
if (in == null) {
logger.warn("plugin resource {} unavailable", internalName);
return null;
} Defensive patterns
Strategy: fallback
Validate before calling
if (targetClassLoader != Object.class.getClassLoader()) { throw new IllegalArgumentException("not bootstrap loader"); } Try / catch
InputStream in = handler.getResourceAsStream(cl, internalName);
if (in == null) { log.warn("no bytecode stream for {}", internalName); return null; } Prevention
- Null-check the returned stream before use
- Ensure appendToBootstrapClassLoaderSearch succeeded before lookup
- Use correct internalName format (path/Foo.class)
- Watch for security-manager denials in the log
When it happens
Trigger: Any Exception (I/O, security, ClassCastException on the loader, etc.) thrown while appending to bootstrap search or fetching internalName as a stream from the bootstrap classloader.
Common situations: Plugin jar not on the bootstrap path; resource name (internal name with .class) mistyped; security manager denying classloader access; plugin jar unreadable.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Failed to load plugin resource as stream {} with classLoader
- Failed to load plugin resource as stream {} with classLoader
- IOException parsing
- Error opening stream :
- not found Caused by:
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/237740fdb3c6be22.
Report an issue: GitHub.