pinpoint-apm/pinpoint · error · InstrumentException
@Aspect not found. adviceClass=${adviceClassInternalName}
Error message
@Aspect not found. adviceClass=${adviceClassInternalName} What it means
ASMAspectWeaver.weaving() requires the advice class to be annotated with @Aspect. The weaver locates pointcut and utility methods via that annotation's metadata; without it the weaving contract is not met, so InstrumentException is thrown naming the advice class.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java:57
public ASMAspectWeaver() {
this(DEFAULT_METHOD_NAME_REPLACER);
}
public ASMAspectWeaver(final MethodNameReplacer methodNameReplacer) {
this.methodNameReplacer = methodNameReplacer;
}
public void weaving(final ASMClassNodeAdapter sourceClassNode, final ASMClassNodeAdapter adviceClassNode) throws InstrumentException {
if (sourceClassNode == null || adviceClassNode == null) {
throw new InstrumentException("source and advice class node must not be null.");
}
if (logger.isInfoEnabled()) {
logger.info("weaving sourceClass={} adviceClass={}", sourceClassNode.getInternalName(), adviceClassNode.getInternalName());
}
if (!adviceClassNode.hasAnnotation(Aspect.class)) {
throw new InstrumentException("@Aspect not found. adviceClass=" + adviceClassNode.getInternalName());
}
// advice class hierarchy check.
final boolean isSubclass = adviceClassNode.subclassOf(sourceClassNode.getInternalName());
if (!isSubclass) {
final String superClassInternalName = adviceClassNode.getSuperClassInternalName();
if (superClassInternalName == null || !superClassInternalName.equals("java/lang/Object")) {
throw new InstrumentException("invalid class hierarchy. source class=" + sourceClassNode.getInternalName() + ", advice class=" + adviceClassNode.getInternalName() + ", super class=" + superClassInternalName);
}
}
// find annotation methods and copy utility methods.
final MethodNodes methodNodes = findMethodNodes(adviceClassNode);
copyUtilMethods(methodNodes, sourceClassNode);
copyPointCutMethods(methodNodes, sourceClassNode);
}
View on GitHub (pinned to 744c3d3075)
Solutions
- Add @Aspect to the advice class
- Verify the correct Aspect annotation (pinpoint's, not another library's) is imported
- Recompile/redeploy the advice class with the annotation present
- Check the compiled class bytes actually contain the annotation (javap or classdump)
Example fix
// before
public class MyAdvice { ... }
// after
import com.navercorp.pinpoint.profiler.instrument.aspect.Aspect;
@Aspect
public class MyAdvice { ... } Defensive patterns
Strategy: validation
Validate before calling
if (!adviceClassNode.hasAnnotation(Aspect.class)) { throw new IllegalArgumentException("advice class must be annotated @Aspect: " + adviceClassNode.getInternalName()); } Try / catch
try { weaver.weaving(src, adv); } catch (InstrumentException e) { if (e.getMessage().contains("@Aspect not found")) { logger.error("advice missing @Aspect"); } } Prevention
- Always annotate advice classes with pinpoint's @Aspect
- Re-verify annotations after refactoring imports
- Inspect compiled bytecode with javap when in doubt
When it happens
Trigger: Weaving an advice class whose bytecode lacks the @Aspect annotation (com.navercorp.pinpoint.profiler.instrument.aspect.Aspect) — e.g. passing an arbitrary class as advice.
Common situations: After refactoring, the @Aspect annotation was removed or the import changed; or a plugin's advice class was compiled against a different Pinpoint version where the annotation package differs.
Related errors
- source and advice class node must not be null.
- invalid class hierarchy. source class=${sourceClassInternalN
- non private UtilMethod unsupported. method=${methodLongName}
- not found method. ${classInternalName}.${methodName}
- Signature miss match. method=${methodName}, source=${sourceD
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/fc9a611fa81a6f16.
Report an issue: GitHub.