pinpoint-apm/pinpoint · error · InstrumentException

not found 'set' method, className=

Error message

not found 'set' method, className=

What it means

ASMInterceptorHolder.init reflectively invokes the static set(Supplier) method on the generated InterceptorHolder class to inject the interceptor supplier. This InstrumentException is thrown when getDeclaredMethod("set", Supplier.class) finds no such method, meaning the class passed in is not a properly generated InterceptorHolder (which always declares static set).

Source

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

        } 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) {
            throw new InstrumentException("access fail, className=" + interceptorHolderClass.getName(), e);
        } catch (InvocationTargetException e) {
            throw new InstrumentException("invocation fail, className=" + interceptorHolderClass.getName(), e);
        }
    }

    public Class<?> loadClass(ClassLoader classLoader) throws InstrumentException {
        try {
            return Class.forName(className, false, classLoader);
        } catch (ClassNotFoundException e) {
            throw new InstrumentException("not found InterceptorHolderClass, className=" + className);
        }
    }

    public Class<?> defineClass(ClassLoader classLoader) throws InstrumentException {
        try {
            final byte[] mainClassBytes = toMainClassByteArray();

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Pass the Class returned by defineClass(...)/build(), not the interceptor or target class
  2. Ensure the holder class was generated by the same ASMInterceptorHolder version performing init
  3. Check the agent build integrity — the InterceptorHolder.class template resource must be present in the profiler jar
  4. If forking, keep the static set(Supplier)/get() methods in the InterceptorHolder template

Example fix

// before
holder.init(interceptorClass, factory, ...);
// after
Class<?> holderClass = holder.defineClass(classLoader);
holder.init(holderClass, factory, ...);
Defensive patterns

Strategy: validation

Validate before calling

// only pass classes produced by defineClass
if (!holderClass.getName().startsWith("com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorHolder$$")) {
    throw new IllegalArgumentException("not a generated holder class: " + holderClass.getName());
}

Type guard

boolean isGeneratedHolder(Class<?> c) {
    return c != null && c.getName().startsWith("com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorHolder$$");
}

Try / catch

try {
    holder.init(clazz, factory, interceptorClass, args, scopeInfo, methodDescriptor);
} catch (InstrumentException e) {
    logger.error("init failed for {}: {}", clazz.getName(), e.getMessage());
}

Prevention

When it happens

Trigger: Calling init(interceptorHolderClass, ...) with a class that is not the product of ASMInterceptorHolder.defineClass — e.g. passing the interceptor class itself instead of the holder class, or a holder class produced by an incompatible agent/ASM version whose template lacks the set method.

Common situations: Wiring up the Builder incorrectly and passing the wrong Class object; mixing plugin classes from a different Pinpoint agent version; a custom fork that changed the InterceptorHolder template.

Related errors


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