Example usage for java.lang LinkageError getCause

List of usage examples for java.lang LinkageError getCause

Introduction

In this page you can find the example usage for java.lang LinkageError getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:org.hyperic.hq.plugin.websphere.WebsphereUtil.java

public static AdminClient getMBeanServer(Properties cfg) throws MetricUnreachableException {

    Properties props = getAdminProperties(cfg);

    if (log.isDebugEnabled()) {
        log.debug("Attempting to create admin client with props " + props + " from config " + cfg);
    }//from ww  w  .  j a v  a2s.  c o m

    AdminClient mServer;
    WebsphereStopWatch timer = new WebsphereStopWatch();

    // http://blogs.sun.com/sunabl/entry/websphere_application_server_and_jvm ????
    // XXX test it with solaris version.
    try {
        mServer = AdminClientFactory.createAdminClient(props);
    } catch (LinkageError e) {
        log.error("Incorrect JVM ??? !!!", e);
        throw new MetricUnreachableException(e.getMessage(), e);
    } catch (ConnectorException ex) {
        Throwable e = ex;
        while ((e = (Throwable) e.getCause()) != null) {
            if (e instanceof LinkageError) {
                throw new MetricUnreachableException("!!! Incorrect JVM !!!", e);
            }
        }
        throw new MetricUnreachableException(ex.getMessage(), ex);
    }

    if (log.isDebugEnabled() && timer.isTooLong()) {
        log.debug("createAdminClient took: " + timer.getElapsedSeconds() + " seconds");
    }

    return mServer;
}