3 Replies Latest reply on Sep 9, 2010 8:30 AM by bghosh1

    Poincut Expression

    bghosh1

      Hi


      I am new to JBoss AOP and at the beginning I am stuck with a poincut expression.

      I am behind a logger aspect which should log every methods under "com.mycompany" and it's sub packages.

      I come from spring background where "execution(* com.mycompany..*.*(..))" works.

      Here I  tried with "execution(com.mycompany.*->*(..))" as suggested in some site..but it never works.

      I went through AOP Docs http://docs.jboss.org/jbossaop/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/pointcuts.html

      It says ".. following a package-name is used to specify all classes from within a given package ut not within sub-packages"

      but it nowhere says what should be done to include sub-packages.


      Can anybody point out where I am going wrong.


      By the way.. I am running in a standalone application with jboss-aop-single.jar in classpath
      and along with vm args :

      -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader
      -Djboss.aop.class.path=D:\Payer-Wrkspc\dc-common\target\classes\com\intuit\payer\dc\common\aspect

      -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader

      -Djboss.aop.class.path=<--path to my aspect class-->

        • 1. Re: Poincut Expression
          kabirkhan

          You need to specify the return type for methods. So

           

          "execution(* com.mycompany.*->*(..))"

           

          should work (notice the extra '* ' before 'com.mycompany'

          • 2. Re: Poincut Expression
            kabirkhan

            BTW you should use the user forums for this, not the design forums. I'm moving this thread there

            • 3. Re: Poincut Expression
              bghosh1

              Kabir

               

              Thanks..The issue finally got resolved after your answer.. though I tried the same expression earlier but was getting some error.

               

              Once I saw your answer, I looked back at the error and saw I was getting stackoverflow exception. The reason behind is

              that since it was a small POC, I kept the logger aspect right under package com.mycompany and hence the log method was getting called recursively.

              I was so stupid to do that.

              Initially I did not look at the error as I did not have enough confidence on the correctness of that expr.

               

              Sorry for bothering you and placing the discussion in wrong forum.