2 Replies Latest reply on Jun 7, 2013 6:05 AM by Meriem L. AARIZOU

    how to create an interceptor annotation with a method not declared in my remote interface in JBoss AS 7.1

    Meriem L. AARIZOU Newbie

      Hi everyone!

      I'm trying to create an interceptor on a stateless EJB session bean. There is a lot of tutorials about this, and it seams easy I know, but the problem is that when I put the annotation before a non remote method, I mean a method which is not invoked by the client but by an other method of the service, the annotation is escaped.

      something like that:

       

      /* the EJB bean code*/

      public class Bean implements BeanInterface {

       

           public void method1() {

                                                   ......

                                                   method2(); //a call of a second method

                                                   ......

                                              }

           @Interceptors(ClassInterceptor.class)

           public void method2(){

                                              ......

                                              ......

                                              }

      }

       

      /*the interface code*/

      public interface BeanInterface{

           public void method1();

      }

       

      /*and somewhere in the client code*/

      bean.method1();

       

      The interceptor ClassInterceptor is escaped. Even whene I add method2() in the interface. It must be called by the client with a lookup if I want it works.

      Is there any connection between the annoations and the EJB service? And how can create an interceptor annotation with a method not declared in my remote interface?

      Thank you all. See you.