Throwable rootCause = jmxEx;
Throwable cause = rootCause;
for (;;)
{
if ( cause == null ||
!( cause instanceof MBeanException ||
cause instanceof RuntimeMBeanException ||
cause instanceof RuntimeOperationsException ) ) {
break;
}
rootCause = cause.getCause();
cause = rootCause;
}
if ( rootCause instanceof ServiceEngineException ){
return (ServiceEngineException) rootCause;
} else {
return new ServiceEngineException(rootCause);
}