import org.apache.commons.lang3.StringUtils;
String expmsg = StringUtils.substring(ExceptionUtils.getStackTrace(e), 0, 300);