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