0 Replies Latest reply on May 27, 2010 1:02 PM by David Murphy

    AOP Newbie - Basic Interceptor Wont Work

    David Murphy Newbie

      Hi - I have a simple interceptor  running in JBOSS AS 5 that will never run. Here is the jboss-aop.xml which is deployed in the ...server\all\deploy  directory.

       

      <aop  xmlns="urn:jboss:aop-beans:1.0">

        <interceptor  scope="PER_VM"/>

        <bind pointcut="execution(*  com.xxx.remote.usersource.sso.SsoUserSource->*(..))">

          <interceptor-ref  name="com.xxx.platform.aop.Test"/>

        </bind>

      </aop>

       

      Here is the interceptor  code

       

      package com.xxx.platform.aop;

      public  class Test implements org.jboss.aop.advice.Interceptor {

       

           public Object  invoke(Invocation invocation) throws Throwable {

              long startTime =  System.currentTimeMillis();

              System.out.println("AOP  ====================> start");

              try {

                  return  invocation.invokeNext();

              } finally {

                  long endTime =  System.currentTimeMillis() - startTime;

                   java.lang.reflect.Method m = ((MethodInvocation)  invocation).getMethod();

                  System.out.println("AOP  ====================> method " + m.toString() + " time: " + endTime +  "ms");

               }

          }

       

           @Override

          public String getName() {

               System.out.println("AOP ====================> GETNAME");

              return  Test.class.getName();

          }

      }

       

      Here is the class with one of its methods I am  trying to AOP enable:-

       

      package com.xxx.remote.usersource.sso;

      public class SsoUserSource  implements .. {

      ..

      private SSOwsPort getSsoServicePort() {

      ..

      }

       

      Despite this  method definitely being executed during running the application the  interceptor is never called. Anyone know what is wrong?

      thx

      David