{"record":{"id":"fc9a611fa81a6f16","repo":"pinpoint-apm/pinpoint","slug":"aspect-not-found-adviceclass-adviceclassintern","errorCode":null,"errorMessage":"@Aspect not found. adviceClass=${adviceClassInternalName}","messagePattern":"@Aspect not found\\. adviceClass=(.+?)","errorType":"exception","errorClass":"InstrumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java","lineNumber":57,"sourceCode":"    public ASMAspectWeaver() {\n        this(DEFAULT_METHOD_NAME_REPLACER);\n    }\n\n    public ASMAspectWeaver(final MethodNameReplacer methodNameReplacer) {\n        this.methodNameReplacer = methodNameReplacer;\n    }\n\n    public void weaving(final ASMClassNodeAdapter sourceClassNode, final ASMClassNodeAdapter adviceClassNode) throws InstrumentException {\n        if (sourceClassNode == null || adviceClassNode == null) {\n            throw new InstrumentException(\"source and advice class node must not be null.\");\n        }\n\n        if (logger.isInfoEnabled()) {\n            logger.info(\"weaving sourceClass={} adviceClass={}\", sourceClassNode.getInternalName(), adviceClassNode.getInternalName());\n        }\n\n        if (!adviceClassNode.hasAnnotation(Aspect.class)) {\n            throw new InstrumentException(\"@Aspect not found. adviceClass=\" + adviceClassNode.getInternalName());\n        }\n\n        // advice class hierarchy check.\n        final boolean isSubclass = adviceClassNode.subclassOf(sourceClassNode.getInternalName());\n        if (!isSubclass) {\n            final String superClassInternalName = adviceClassNode.getSuperClassInternalName();\n            if (superClassInternalName == null || !superClassInternalName.equals(\"java/lang/Object\")) {\n                throw new InstrumentException(\"invalid class hierarchy. source class=\" + sourceClassNode.getInternalName() + \", advice class=\" + adviceClassNode.getInternalName() + \", super class=\" + superClassInternalName);\n            }\n        }\n\n        // find annotation methods and copy utility methods.\n        final MethodNodes methodNodes = findMethodNodes(adviceClassNode);\n\n        copyUtilMethods(methodNodes, sourceClassNode);\n        copyPointCutMethods(methodNodes, sourceClassNode);\n    }\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java#L39-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before\npublic class MyAdvice { ... }\n// after\nimport com.navercorp.pinpoint.profiler.instrument.aspect.Aspect;\n\n@Aspect\npublic class MyAdvice { ... }","handlingStrategy":"validation","validationCode":"if (!adviceClassNode.hasAnnotation(Aspect.class)) { throw new IllegalArgumentException(\"advice class must be annotated @Aspect: \" + adviceClassNode.getInternalName()); }","typeGuard":null,"tryCatchPattern":"try { weaver.weaving(src, adv); } catch (InstrumentException e) { if (e.getMessage().contains(\"@Aspect not found\")) { logger.error(\"advice missing @Aspect\"); } }","preventionTips":["Always annotate advice classes with pinpoint's @Aspect","Re-verify annotations after refactoring imports","Inspect compiled bytecode with javap when in doubt"],"tags":["java","bytecode","asm","aspect","annotation"],"backgroundTag":"missing-required-annotation","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}