tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Possible OPENEJB Bug with Interceptors?
Date Thu, 22 Oct 2009 22:13:16 GMT

On Oct 22, 2009, at 1:05 PM, Marrrck wrote:

> The issue I'm having in a nutshell is that my interceptor is not being
> called for public session bean methods that are called from within  
> other
> methods in the same class.

> ///////// session bean impl
> @Stateful
> @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
> @Interceptors(TestInterceptor .class)
> public class mySessionBean implements mySessionBeanLocal {
>   @Override
>   public void method1() {
>     System.out.println("Method 1 invoked!");
>    method2();
>   }
>   @Override
>   public void method2() {
>    System.out.println("Method 2 invoked!");
>   }
> }

Per EJB spec if you wanted container managed anything you have to go  
through the business interface.  This is the motivation for these  
methods on javax.ejb.SessionContext:

     javax.ejb.EJBLocalObject getEJBLocalObject();
     javax.ejb.EJBObject getEJBObject();
     java.lang.Object getBusinessObject(java.lang.Class aClass);

You can do what you want portably like so:

   public void method1() {
     System.out.println("Method 1 invoked!");


Clearly JBoss is using byte code enhancement to add container managed  
features directly to your bean class.  This is certainly a neat idea  
-- kicked it around myself a few times -- but not a feature of EJB.  I  
don't know if I'd go as far to say that it's illegal or a bug, but it  
is definitely a very container specific feature  (really more like a  
very container specific architecture).


View raw message