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
PluginClassInjector.getResourceAsStream fetches a plugin class's bytecode stream via the URL or plain handler. Any Throwable during routing or lookup is logged with this warn and null is returned; the error is deliberately swallowed so instrumentation can degrade instead of crashing. Null means the resource stream is unavailable.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/classloading/PluginClassInjector.java:99
}
}
@Override
public InputStream getResourceAsStream(ClassLoader targetClassLoader, String internalName) {
try {
if (bootstrapCore.isBootstrapPackageByInternalName(internalName)) {
return bootstrapCore.openStream(internalName);
}
if (targetClassLoader == null) {
return bootstrapClassLoaderHandler.getResourceAsStream(null, internalName);
} else if (targetClassLoader instanceof URLClassLoader) {
final URLClassLoader urlClassLoader = (URLClassLoader) targetClassLoader;
return urlClassLoaderHandler.getResourceAsStream(urlClassLoader, internalName);
} else {
return plainClassLoaderHandler.getResourceAsStream(targetClassLoader, internalName);
}
} catch (Throwable e) {
logger.warn("Failed to load plugin resource as stream {} with classLoader {}", internalName, targetClassLoader, e);
return null;
}
}
}View on GitHub (pinned to 744c3d3075)
Solutions
- Check the exception stack trace attached to this warn for the true cause.
- Fix loader routing so only URLClassLoaders reach urlClassLoaderHandler.
- Validate internalName (package/path + ".class") and that the resource exists in the plugin jar.
- Ensure call sites null-check the returned stream before reading.
Example fix
// before
byte[] bytes = IOUtils.toByteArray(injector.getResourceAsStream(targetClassLoader, internalName));
// after
InputStream in = injector.getResourceAsStream(targetClassLoader, internalName);
if (in == null) { return null; }
byte[] bytes = IOUtils.toByteArray(in); Defensive patterns
Strategy: fallback
Validate before calling
if (targetClassLoader instanceof URLClassLoader) { /* url handler path */ } else { /* plain handler path */ } Type guard
static InputStream safeGetResource(PluginClassInjector injector, ClassLoader cl, String internalName) {
InputStream in = injector.getResourceAsStream(cl, internalName);
return in != null ? in : cl.getResourceAsStream(internalName);
} Try / catch
InputStream in = injector.getResourceAsStream(cl, internalName);
if (in == null) { log.warn("resource {} unavailable", internalName); return null; } Prevention
- Null-check the stream before reading
- Only route URLClassLoaders to the URL handler
- Use correct internalName format (path/Foo.class)
- Avoid lookups on closed/redeployed classloaders
When it happens
Trigger: Any Throwable thrown by urlClassLoaderHandler.getResourceAsStream (e.g. ClassCastException when the loader is not a URLClassLoader) or plainClassLoaderHandler.getResourceAsStream while resolving internalName.
Common situations: Non-URLClassLoader loaders incorrectly routed to the URL handler; closed webapp classloaders after redeploy; unreadable plugin jar; wrong internalName format.
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/be900c3a9d7c38a3.
Report an issue: GitHub.