1 Reply Latest reply on Feb 11, 2010 6:22 PM by Nikos Paraskevopoulos

    Intercepting calls to methods in external EJB

    Nicola Diana Newbie

      Hi All, i am a beginner to use SEAM,

      I need to build web application that intercept calls to methods that are in an external EJB. That is, in the EJB deployed in an external JAR, not included into my web application EAR.

      I succeeded to intercept all calls from internal methods on my web application. In META-INF/ejb-jar.xml i wrote the following code:


      And the class MyClassInterceptor i added the following method

      public Object MetodoInterceptor(InvocationContext ctx) throws Exception
         System.out.println("Interceptor - Method: "+ ctx.getMethod().getName());
         return ctx.proceed();

      The question is: How do I intercept calls to external EJB?

      Forgive me if my English is not perfect

      by Nick Nolton

        • 1. Re: Intercepting calls to methods in external EJB
          Nikos Paraskevopoulos Novice


          If you have access to the ejb-jar.xml of the external EJBs, you can add the same interceptor binding. I consider this legitimate by the specs, it is the Deployer role.

          If you do not have access to the external EJBs things are trickier. Ideas: (never implemented any ot them though) You may use AOP to instrument the bean implementation classes. It may even suffice to instrument the business interfaces, in which case you will not have access to the transaction context etc, especially for remote clients.