try {
value = m.invoke(bean, localCallRequest.getMethodArgs());
} catch (IllegalArgumentException e) {
ejbResponse.setRPCException(new RPCException(e));
if (enabledEvent) {
getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
}
} catch (IllegalAccessException e) {
ejbResponse.setRPCException(new RPCException(e));
if (enabledEvent) {
getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
}
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
RPCException rpcException = new RPCException(cause);
// ApplicationException ?
ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(
cause.getClass().getName());
if (applicationException != null) {
rpcException.setApplicationException();
}
ejbResponse.setRPCException(rpcException);
if (enabledEvent) {
getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
}
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
getInvokedBusinessInterfaceNameThreadLocal().set(oldInvokedBusinessInterface);
getOperationStateThreadLocal().set(oldState);