Found the issue to my problem.

The default constructor was calling a method of another class before the
aspect was initialized, which caused the exception.

What is the approach to initialize aspect state without hitting this
exception?


On Mon, Nov 19, 2012 at 8:38 PM, Brian Toal <brian.t...@gmail.com> wrote:

> 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?
>
>
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to