final RemoteException re = new RemoteException(message, error);
final EJBResponse res = new EJBResponse();
res.setResponse(ResponseCodes.EJB_ERROR, new ThrowableArtifact(re));
try {
res.writeExternal(out);
} catch (Throwable t) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to write EjbResponse", t);
} else if (logger.isWarningEnabled()) {
logger.warning("Failed to write EjbResponse - Debug for stacktrace");