Announcement Announcement Module
Collapse
No announcement yet.
Error while getting JoinPoint.EnclosingStaticPart for Around advice. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error while getting JoinPoint.EnclosingStaticPart for Around advice.

    I am getting a "java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut" error when I add the "enclosingStaticPart" to argNames for Around advice.
    I have the following code:

    Code:
        @Around(value = "@annotation(trace)", argNames = "pjp, enclosingStaticPart, trace")
        static Object timeMethod(final ProceedingJoinPoint pjp, final JoinPoint.EnclosingStaticPart enclosingStaticPart, final PerfTimed timed) throws Throwable {
            String caller = enclosingStaticPart.getSignature().toLongString();
            System.out.println("********** Caller  :  " + caller);
            return time(pjp, timed);
        }
    I am using spring 3.0.5.RELEASE, aspectj 1.6.1.

    I am stuck on this for sometime now. Any help will be greatly appreciated.

  • #2
    You cannot use that as a method argument. You have to retrieve it inside your method from the JoinPoint...

    Comment


    • #3
      I tried to get the EnclosingStaticPart from ProceedingJoinPoint by but couldn't get it right. Can you please give me an example?

      Comment


      • #4
        Hi all,

        Even I'm stuck at the same problem. I wish to know the parent method of the method in which the JoinPoint is, and I'm not able to get it despite try all possible techniques.

        Please reply if you know how this can be achieved.

        Thanks in advance!

        Comment


        • #5
          Simply get the staticpart (joinpoint.getStaticPart) check if the type is of EnclosingStaticPart (if you really need it) and cast it.

          Comment

          Working...
          X