0 Replies Latest reply on Jun 9, 2011 1:12 PM by robert.m.goodwin

    JBoss AS 5.1 Remote EJB calls not being intercepted

    robert.m.goodwin

      I have a Stateless EJB/ WebService that I have added a  Aspect and a corresponding jboss-aop.xml to so I can get information about calls made to the public interface of the service.  It appears though that remote calls to the service are not being intercepted ( atleast the log messages that I have are not being printed).  In the public interface I do have methods that call other methods on the public interface, those methods do get intercepted.  It appears that only local calls are working.  This is simular to the problem dicussed here (https://issues.jboss.org/browse/JBAS-7172)

       

      In other words, if I have a EJB that has public interface methods A,B and C where

       

      A calls B

      C calls A

       

      If a remote client calls A, I get log statements about entering and exiting B, but not A

      if a remote client calls C, I get log statements about entering and exiting A, but not C

       

       

      My jboss-aop.xml file

       

      {code}

      <?xml version="1.0" encoding="UTF-8"?> 

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

        <aspect class="mc2sa.mdr.SoiServiceAspect"/>

        <bind pointcut="execution(public * mc2sa.mdr.MetadataRegistryService->*(..))">

           <around aspect="mc2sa.mdr.SoiServiceAspect" name="invoke"/>

        </bind>

        </aop>

      {code}

       

      Aspect code

       

      {code}

      import org.jboss.aop.advice.Interceptor;

      import org.jboss.aop.joinpoint.Invocation;

      import org.jboss.aop.joinpoint.MethodInvocation;

      import org.jboss.logging.Logger;


      public class SoiServiceAspect implements Interceptor

      {

         private static final Logger log = Logger.getLogger(SoiServiceAspect.class);

       

         public String getName()

      {

           return "SoiServiceAspect";

      }

       

         public Object invoke(Invocation invocation) throws Throwable

      {

            MethodInvocation mi = (MethodInvocation) invocation;

            String methodName = mi.getMethod().toString();

       

            try {

                log.info("Entering: " + methodName);

                return invocation.invokeNext();

            } finally {

                log.info("Leaving: " + methodName);

            }

         }

       

        }

      {code}

       

      The jboss-aop.xml file is in the root of the jar that provides the service. and the aspect is in the same package as the service.  Is this a bug, or more likely, am I missing something in the configuration that would allow my aspect to be called when being invoked remotely?

       

      Thanks,

      Rob