pinpoint-apm/pinpoint · error · IllegalArgumentException
unknown scanner type classLoader:${classLoader} protectionDo
Error message
unknown scanner type classLoader:${classLoader} protectionDomain:${protectionDomain} What it means
ClassScannerFactory.newScanner could not determine a scanner strategy for the given class: neither the ClassLoader nor the ProtectionDomain provided a usable class-loading source. It throws IllegalArgumentException describing both inputs.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/scanner/ClassScannerFactory.java:59
final URL codeLocation = CodeSourceUtils.getCodeLocation(protectionDomain);
if (codeLocation == null) {
return new ClassLoaderScanner(classLoader);
}
final Scanner scanner = newURLScanner(codeLocation);
if (scanner != null) {
return scanner;
}
// workaround for scanning for classes in nested jars - see newURLScanner(URL) below.
if (FORCE_CLASS_LOADER_SCANNER || isNestedJar(codeLocation.getPath())) {
ClassLoader protectionDomainClassLoader = protectionDomain.getClassLoader();
if (protectionDomainClassLoader != null) {
return new ClassLoaderScanner(protectionDomainClassLoader);
}
}
throw new IllegalArgumentException("unknown scanner type classLoader:" + classLoader + " protectionDomain:" + protectionDomain);
}
public static Scanner newScanner(ProtectionDomain protectionDomain) {
final URL codeLocation = CodeSourceUtils.getCodeLocation(protectionDomain);
if (codeLocation == null) {
return null;
}
final Scanner scanner = newURLScanner(codeLocation);
if (scanner != null) {
return scanner;
}
return null;
}
private static Scanner newURLScanner(URL codeLocation) {
final String protocol = codeLocation.getProtocol();
if (isFileProtocol(protocol)) {View on GitHub (pinned to 744c3d3075)
Solutions
- Provide a non-null ClassLoader when requesting the scanner
- Ensure the ProtectionDomain has a class loader, or check CodeSource location handling so a JarFileScanner fallback applies
- Skip/bootstrap-exclude classes whose loader is null in the transform filter
Example fix
// before Scanner s = ClassScannerFactory.newScanner(null, protectionDomain); // both null -> throws // after ClassLoader cl = clazz.getClassLoader() != null ? clazz.getClassLoader() : Thread.currentThread().getContextClassLoader(); Scanner s = cl != null ? ClassScannerFactory.newScanner(cl, protectionDomain) : null;
Defensive patterns
Strategy: validation
Validate before calling
if (classLoader == null && (protectionDomain == null || protectionDomain.getClassLoader() == null)) { /* skip or use fallback loader */ } Try / catch
try { scanner = ClassScannerFactory.newScanner(classLoader, pd); } catch (IllegalArgumentException e) { log.warn("no scanner for class, skipping: {}", e.getMessage()); scanner = null; } Prevention
- Exclude bootstrap classes from transform filters
- Always pass the class's real ClassLoader
- Handle a null scanner return defensively
When it happens
Trigger: Calling newScanner with a null classLoader and a ProtectionDomain whose class loader is also null (e.g. bootstrap/primordial classes) so no scanner can be chosen.
Common situations: Instrumenting JDK/bootstrap classes loaded by the bootstrap classloader where getClassLoader() returns null and there is no jar fallback; custom classloading setups where classes are defined via reflection/unsafe with a null protection domain classloader.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Transformer already exists. TransformKey:
- ${className} define fail Caused by:${causeMessage}
- J9BootLoader create fail Caused by:
- initialize fail Caused by:
- invoke fail Caused by:
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/5abe01a03fb47a4a.
Report an issue: GitHub.