Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Pointcut - NoAspectBoundException

I'm trying to create a generic pointcut that allows me to have a Before/After hook into method calls.  The point cut I use is:

    @Pointcut("call(* *(..))")
    public void callPointCut() {
    }

However I'm getting the following error when running the test program:

Exception in thread "main" org.aspectj.lang.NoAspectBoundException: Exception while initializing com.blah.profiler.aspects.ProfilerAspects: org.aspectj.lang.NoAspectBoundException: com.blah.profiler.aspects.ProfilerAspects
    at com.blah.profiler.aspects.ProfilerAspects.aspectOf(ProfilerAspects.java:1)
    at com.blah.profiler.aspects.HelloWorld.main(HelloWorld.java:8)
Caused by: org.aspectj.lang.NoAspectBoundException: com.blah.profiler.aspects.ProfilerAspects
    at com.blah.profiler.aspects.ProfilerAspects.aspectOf(ProfilerAspects.java:1)
    at com.blah.profiler.aspects.ProfilerAspects.<init>(ProfilerAspects.java:13)
    at com.blah.profiler.aspects.ProfilerAspects.ajc$postClinit(ProfilerAspects.java:1)
    at com.blah.profiler.aspects.ProfilerAspects.<clinit>(ProfilerAspects.java:1)
    ... 1 more


I'm assuming the following method is causing the grief in HelloWorld.

public static void main(String[] argv)

When I use the fully qualified class name in the pointcut definition I don't get this error, however I don't understand why the problem above is a issue in that case as well.

For example the following point cut:

    @Pointcut("call(* com.blah.profiler.aspects.HelloWorld(..))")
    public void callPointCut() {
    }

Is called for non-static methods i've defined in HelloWorld.  How do I include static methods in the Pointcut definition?




Back to the top