I am having a problem with an @AroundInvoke interceptor not running for methods that are implemented in a superclass of a Stateless session bean:
public interface A
{
public String getMessage();
}
public interface B extends A
{
String getOtherMessage();
}
abstract public class ABean implements A
{
public String getMessage()
{
return "The Message";
}
}
@Stateless
@Remote(B.class)
@Interceptors({Intercept.class})
public class BBean extends ABean implements B
{
public String getOtherMessage()
{
return "The Other Message";
}
}
public class Intercept
{
@AroundInvoke
Object audit(InvocationContext ctx) throws Exception
{
String message = (String)ctx.proceed();
System.out.println("Interceptor called for "+ctx.getMethod().getName());
return "Intercepted: "+message;
}
}
public class Client
{
public static void main(String[] args) throws Exception
{
Context ctx = new InitialContext();
B b = (B)ctx.lookup("BBean/remote");
System.out.println(b.getMessage());
System.out.println(b.getOtherMessage());
}
}
I meant to say that this is with JBoss4.0.4RC1 - which I believe includes EJB3 RC5 PFD.