Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] NoSuchMethodError: aspectOf()

I'm using the annotations (@Aspect, @Pointcut, etc) and compiling them with javac via the AspectJ plugin for Maven2. During the compilation life cycle, I see that my advice is being applied but when I execute the code in a web app, I get the "NoSuchMethodError: aspectOf()" error. 

I found this thread to be pretty helpful : http://www.mail-archive.com/aspectj-users@xxxxxxxxxxx/msg05084.html but I couldn't get his recommendation to work fully.

I have one maven module (Module A) that contains the aspect and another module (Module B) in which I want to apply the aspects to. I tried passing in Module A as a weaveDependency (aka inPath) to the Module B config:

<configuration>
       <aspectLibraries>
                  <aspectLibrary>
                              <groupId>com.mycompany</groupId>
                                <artifactId>ModuleA</artifactId>
                    </aspectLibrary>
        </aspectLibraries>
        <weaveDependencies>
               <weaveDependency>
                        <groupId>com.mycompany</groupId>
                         <artifactId>ModuleA</artifactId>
                </weaveDependency>
         </weaveDependencies> 
</configuration>


As a result of this, I see the Module A aspect class files are in the target directory but it doesn't seem to prevent the NoSuchMethodError from happening.

Any suggestions?

Thanks in advance!

Back to the top