2 Replies Latest reply on May 2, 2013 8:26 AM by Wolf-Dieter Fink

    EJBClientContext registerInterceptor not working

    Julien Boz Newbie

      Bonjour à tous !


      I want to inject some metad data  into EJBContext like this : https://community.jboss.org/message/757523?tstart=0&_sscc=t

      But my client interceptor is never invoked.


      My code :


      1) EJBClientInterceptor

      public class RegisterUserInterceptor implements EJBClientInterceptor, Serializable {
                private static final long serialVersionUID = 1L;
                public void handleInvocation(final EJBClientInvocationContext context) throws Exception {
                          // store user in context
                          if (!context.getContextData().containsKey("user")) {
                                    context.getContextData().put("user", "hello");
                public Object handleInvocationResult(final EJBClientInvocationContext context) throws Exception {
                          return context.getResult();


      2) registerInterceptor


      version 1 not work :

      public class StartupWebListener implements ServletContextListener {
                public void contextInitialized(ServletContextEvent sce) {
                          // on startup
                          EJBClientContext.getCurrent().registerInterceptor(0, new RegisterUserInterceptor());
                public void contextDestroyed(ServletContextEvent sce) {
                          // on shutdown


      version 2, not work too :

      in file META-INF/services/org.jboss.ejb.client.EJBClientInterceptor




      The web listener is invoke, and my client interceptor is registered, but when i invoke my ejb, the class RegisterUserInterceptor is not invoked


      public class MyWebController implements Serializable {
                private static final long serialVersionUID = 1L;
                @Inject private MyEJBFacade facade;
                public void search(final AjaxBehaviorEvent event) {
                              // call facade, client interceptor must add meta data into call context


      PS : I use jboss 7.0.1.Final and jboss-ejb-client-1.0.16.Final



      Thanks for your help.