Let’s say I have an interceptor that looks smth like this:
public class AuthorizationInterceptor {
Logger log = Logger.getLogger(getClass().getName());
@AroundInvoke
private Object authorize(InvocationContext ic) throws Exception{
// ... some other logic for authorization
if (!allowedMethods.contains(ic.getMethod().getName())){
log.info("Authorization failed. Preparing to throw exception");
throw new AuthException("Authorization failed for method " +
ic.getMethod().getName());
}
return ic.proceed();
}
}
which is applied to different methods from my EJBs.
I would normally expect the exception throed to be passed to the invoking client, like all normal EJB exceptions.
Apparently this doesn’t happen if I throw it from an Interceptor… It’s not even logged on the server; like it’s never thrown although it is – the return statement is never executed.
What am I doing wrong?
I’m using GF 3.0.1
Here are a couple of things to try: