0 Replies Latest reply on Aug 27, 2009 6:08 PM by pmuir

    Getting the ejbName inside an interceptor

    pmuir

      This is for JBoss EJB 3 integration code, so we can use JBoss interfaces, not just EJB standard interfaces.

      Inside an interceptor instance, I need access to the ejbName of the EJB being intercepted (so I can use this as a unique key to look up other info on the EJB). Currently I am doing this ugly hack:

      try {
       guidField = StatefulSessionContextImpl.class.getDeclaredField("containerGuid");
       guidField.setAccessible(true);
       } catch (Exception e) {
       throw new RuntimeException(e);
       }
      
       ...
      
       try {
       String guid = (String) guidField.get(sessionContext);
       Container container = Ejb3Registry.getContainer(guid);
       return container.getEjbName();
       } catch (Exception e) {
       throw new RuntimeException(e);
       }


      Any suggestions on how to improve?