tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marrrck <mmm...@gmail.com>
Subject Possible OPENEJB Bug with Interceptors?
Date Thu, 22 Oct 2009 20:05:40 GMT

Apologies in advance if this has been already reported or I have it wrong.
I've searched and it seems that no one else has encountered my specific
problem....

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. This is a problem for me because I'm trying to do
some exception handling in my generic interceptor, and it is getting
bypassed when a session bean method is called from another method. Here's an
example:

/////// interceptor
public class TestInterceptor {
@AroundInvoke
  public Object interceptor(InvocationContext invocation) throws Exception {
     System.out.println("Interceptor invoked!");
      return invocation.proceed();
  }
}

///////// session bean interface
@Local
public interface mySessionBeanLocal {
   public void method1(); 
   public void method2();
}

///////// 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!");
   }
}

I have a junit test case that is annotated with @LocalClient and has an
injected copy of mySessoinBeanLocal using @EJB. When my unit test calls
method1(), it appears that the interceptor is only triggered when method1()
is called but not when method2() is invoked by method1(). If I deploy the
same code on JBoss, the interceptor is tripped twice as I would expect it to
be. (I'm using Openejb 3.1.1)

Any thoughts/advice/workarounds would be greatly appreciated! Is this a bug
in openejb or a bug in JBoss? (or a bug in my reasoning... )
-- 
View this message in context: http://www.nabble.com/Possible-OPENEJB-Bug-with-Interceptors--tp26016326p26016326.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message