7 Replies Latest reply on May 9, 2004 11:22 AM by Bill Burke

    Interceptor not intercepting

    mriou Newbie

      Hi,

      I wrote an interceptor that should execute on all methods tagged with @@transactional in javadoc. Here is the declaration :





      Compilation is ok. The class is ok and includes JBossAOP hooks (I decompiled it). I also included a breakpoint in AspectXmlLoader.deployInterceptor and my interceptor is deployed at startup. Still my interceptor is not executed before entering in the method.

      What can I do to find the origin of the problem ? Does somebody has an idea ?

        • 1. Re: Interceptor not intercepting
          mriou Newbie

          Trying again to post the pointcut declaration :

          <bind pointcut="all(@transactional)">
           <interceptor class="org.smcp.twister.engine.common.aspect.TransactionInterceptor"/>
           </bind>
          


          • 2. Re: Interceptor not intercepting
            Bill Burke Master

            Did you look at the metadata example that comes with JBoss AOP beta1? You have to run that generates another XML file. Then you must have that XML file and your binding in the jboss.aop.path System property.

            If you change to have report="true" then you can get an XML dump of bindings and metadata attached. You can get the same thing graphically through the JBoss management console if you're running within JBoss.

            Get back to me if you have more problems.

            Bill

            • 3. Re: Interceptor not intercepting
              mriou Newbie

              Sorry about that, metadata-aop.xml was not in jboss.aop.path. Absolutely my fault.

              Thinking about it this property bothers me a bit as in most deployment you don't have a prior knowledge of the file system. Is there a way to make JBossAOP just look in the classpath (like loading it using a classLoader.getResourceAsStream()) ??

              Thanks a lot.

              • 4. Re: Interceptor not intercepting
                Bill Burke Master

                Depends if you are running inside or outside the JBoss application server.

                If outside, then JBoss AOP does this by default:
                Enumeration enum = Thread.currentThread().getContextClassLoader().getResources("META-INF/jboss-aop.xml");

                So any part of your classpath that has a META-INF/jboss-aop.xml file within it will be loaded by JBoss AOP. See the packaging tutorial example for more detail.

                If you are running inside JBoss applications server, this "getResources" feature is turned off. Instead, you must put YOURFILE-aop.xml in the deploy directory, or create a jar named YOURJAR.aop and in the META-INF directory of the YOURJAR.aop jarfile put a jboss-aop.xml. Am I making sense? I will write a "Using within JBoss app server" example for the next release.

                Regards,

                Bill

                • 5. Re: Interceptor not intercepting
                  mriou Newbie

                  I'm running outised the app server and my jboss-aop.xml is properly loaded from the META-INF directory but not the metadata-aop.xml. It seems that the metadata file only gets propery loaded using the jboss.aop.path, is that right ?

                  • 6. Re: Interceptor not intercepting
                    Kabir Khan Master

                    Hi there,

                    Been asked by Bill to let you know he is away giving training. He'll respond eventually, but not as quickly as normal.

                    Cheers,

                    Kab

                    • 7. Re: Interceptor not intercepting
                      Bill Burke Master

                      Yes, that is correct, please see the packaging example though.