Example usage for java.lang NoClassDefFoundError setStackTrace

List of usage examples for java.lang NoClassDefFoundError setStackTrace

Introduction

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

Prototype

public void setStackTrace(StackTraceElement[] stackTrace) 

Source Link

Document

Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTrace() and related methods.

Usage

From source file:org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.java

@VisibleForTesting
org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier> getTimelineDelegationToken()
        throws IOException, YarnException {
    try {//from  w  ww.j  av  a2  s .c  om
        // Only reachable when both security and timeline service are enabled.
        if (timelineClient == null) {
            synchronized (this) {
                if (timelineClient == null) {
                    timelineClient = createTimelineClient();
                    timelineClient.init(getConfig());
                    timelineClient.start();
                }
            }
        }
        return timelineClient.getDelegationToken(timelineDTRenewer);
    } catch (Exception e) {
        if (timelineServiceBestEffort) {
            LOG.warn("Failed to get delegation token from the timeline server: " + e.getMessage());
            return null;
        }
        throw e;
    } catch (NoClassDefFoundError e) {
        NoClassDefFoundError wrappedError = new NoClassDefFoundError(
                e.getMessage() + ". It appears that the timeline client "
                        + "failed to initiate because an incompatible dependency "
                        + "in classpath. If timeline service is optional to this "
                        + "client, try to work around by setting " + YarnConfiguration.TIMELINE_SERVICE_ENABLED
                        + " to false in client configuration.");
        wrappedError.setStackTrace(e.getStackTrace());
        throw wrappedError;
    }
}