About Question enthuware.oce-ejbd.v6.2.551 : Subclasses of exceptions in throws clause of @AroundInvoke method
Posted: Tue Oct 15, 2013 3:11 am
Description of one of the wrong answers is:
EJB 3.1 specification says:
I tested on Weblogic, that subclasses of Exception in throws clause of an interceptor method are not valid. There's an error during deployment.
However in question enthuware.oce-ejbd.v6.2.519 there's such a code snippet:The signature of @AroundInvoke method must have "throws Exception" part. This is required.
Code: Select all
@AroundInvoke
public Object myAround(InvocationContext ic) throws NoAccountException
However Java EE 6 API gives the following signature for an interceptor method:Business method interceptor methods may throw runtime exceptions or application exceptions that are allowed in the throws clause of the business method.
Code: Select all
@AroundInvoke
public Object intercept(InvocationContext ctx) throws Exception { ... }
That's why I think that either Java EE 6 API is inaccurate (should allow Exception subclasses) or you shouldn't use signature with "throws NoAccountException" and say that "throws Exception" is required in another place, if it's not clear what is really compatible with specification.weblogic.ejb.container.compliance.ComplianceException: AroundInvoke method myInterceptor in class oce.ejbd.MySLSInterceptor must have the signature: 'Object <METHOD(InvocationContext)> throws Exception'