pinpoint-apm/pinpoint · error · InstrumentException

access fail, className=

Error message

access fail, className=

What it means

After finding the declared static 'get' method, loadInterceptorClass calls method.invoke(null). This InstrumentException wraps IllegalAccessException, thrown because the method is not accessible from the caller's context (e.g. the generated class is defined in another package/classloader without setAccessible, or a security manager/JPMS module blocks reflective access).

Solutions

  1. Grant reflective access to com.navercorp.pinpoint classes in the security policy or remove the SecurityManager restriction
  2. Add --add-opens/--add-exports JVM flags for the affected package on JDK 9+
  3. Confirm the holder class was defined by InterceptorDefineClassHelper into the intended classloader (bootstrap vs app)
  4. Update the agent to a version matching your JDK (older agents may not handle strong encapsulation)

Example fix

// before (JDK 16+ strong encapsulation)
java -jar app.jar
// after
java --add-opens java.base/java.lang=ALL-UNNAMED -jar app.jar
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Class<? extends Interceptor> c = holder.loadInterceptorClass(classLoader);
} catch (InstrumentException e) {
    if (e.getCause() instanceof IllegalAccessException) {
        logger.error("reflective access denied for {}; add --add-opens or relax SecurityManager", holder.getClassName());
    }
}

Prevention

When it happens

Trigger: Calling loadInterceptorClass when the holder class was defined in a classloader/package whose reflection access is denied — typically under a Java SecurityManager with restrictive policy, or on JDK 9+ strong encapsulation when crossing module/package boundaries.

Common situations: Running the agent on a locked-down application server with a SecurityManager, or attaching to a modular (JPMS) application where the generated holder lands in an unnamed module restricted from reflection.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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

Appendix: source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMInterceptorHolder.java:106

            final Class<?> clazz = loadClass(classLoader);
            if (clazz == null) {
                // defense code
                throw new InstrumentException("not found interceptorHolderClass, className=" + className);
            }

            final Method method = clazz.getDeclaredMethod("get");
            final Object o = method.invoke(null);
            if (o instanceof Interceptor) {
                return (Class<? extends Interceptor>) o.getClass();
            } else {
                throw new InstrumentException("not found interceptor, className=" + className);
            }
        } catch (InvocationTargetException e) {
            throw new InstrumentException("invocation fail, className=" + className, e);
        } catch (NoSuchMethodException e) {
            throw new InstrumentException("not found 'get' method, className=" + className, e);
        } catch (IllegalAccessException e) {
            throw new InstrumentException("access fail, className=" + className, e);
        }
    }

    public void init(Class<?> interceptorHolderClass, InterceptorFactory factory, Class<? extends Interceptor> interceptorClass, Object[] providedArguments, ScopeInfo scopeInfo, MethodDescriptor methodDescriptor) throws InstrumentException {
        init(interceptorHolderClass, new InterceptorLazyLoadingSupplier(factory, interceptorClass, providedArguments, scopeInfo, methodDescriptor));
    }

    public void init(Class<?> interceptorHolderClass, Interceptor interceptor) throws InstrumentException {
        init(interceptorHolderClass, new InterceptorSupplier(interceptor));
    }

    private void init(Class<?> interceptorHolderClass, Supplier<Interceptor> supplier) throws InstrumentException {
        try {
            final Method method = interceptorHolderClass.getDeclaredMethod("set", Supplier.class);
            method.invoke(null, supplier);
        } catch (NoSuchMethodException e) {
            throw new InstrumentException("not found 'set' method, className=" + interceptorHolderClass.getName(), e);
        } catch (IllegalAccessException e) {

View on GitHub (pinned to 744c3d3075)