Example usage for java.lang NoClassDefFoundError printStackTrace

List of usage examples for java.lang NoClassDefFoundError printStackTrace

Introduction

In this page you can find the example usage for java.lang NoClassDefFoundError printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:org.apache.oozie.action.ActionExecutor.java

/**
 * Register error handling information for an exception.
 *
 * @param exClass exception class name (to work in case of a particular exception not being in the classpath, needed
 * to be able to handle multiple version of Hadoop  or other JARs used by executors with the same codebase).
 * @param errorType error type for the exception.
 * @param errorCode error code for the exception.
 *///from  w  w  w .j  av  a 2s . c o  m
protected void registerError(String exClass, ActionExecutorException.ErrorType errorType, String errorCode) {
    if (!initMode) {
        throw new IllegalStateException("Error, action type info locked");
    }
    try {
        Class errorClass = Thread.currentThread().getContextClassLoader().loadClass(exClass);
        Map<String, ErrorInfo> executorErrorInfo = ERROR_INFOS.get(getType());
        executorErrorInfo.put(exClass, new ErrorInfo(errorType, errorCode, errorClass));
    } catch (ClassNotFoundException cnfe) {
        XLog.getLog(getClass()).warn(
                "Exception [{0}] not in classpath, ActionExecutor [{1}] will handle it as ERROR", exClass,
                getType());
    } catch (java.lang.NoClassDefFoundError err) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        err.printStackTrace(new PrintStream(baos));
        XLog.getLog(getClass()).warn(baos.toString());
    }
}