Example usage for java.lang UnsatisfiedLinkError getMessage

List of usage examples for java.lang UnsatisfiedLinkError getMessage

Introduction

In this page you can find the example usage for java.lang UnsatisfiedLinkError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.hyperic.hq.plugin.postgresql.ServerMeasurement.java

protected void initSigar() throws PluginException {
    if (this.sigar == null) {
        try {/*from  w  w w .j  av a 2  s  .  c  o m*/
            this.sigar = new Sigar();
            this.sigarProxy = SigarProxyCache.newInstance(sigar);
        } catch (UnsatisfiedLinkError ex) {
            log.debug("unable to load sigar: " + ex.getMessage(), ex);
            this.sigar = null;
            this.sigarProxy = null;
            throw new PluginException(ex.getMessage(), ex);
        }
    }

}

From source file:org.jenkinsci.plugins.mesos.MesosCloud.java

public void restartMesos() {

    if (!nativeLibraryLoaded) {
        // First, we attempt to load the library from the given path.
        // If unsuccessful, we attempt to load using 'MesosNativeLibrary.load()'.
        try {//from w  w w  .jav a  2  s .c  o m
            MesosNativeLibrary.load(nativeLibraryPath);
        } catch (UnsatisfiedLinkError error) {
            LOGGER.warning("Failed to load native Mesos library from '" + nativeLibraryPath + "': "
                    + error.getMessage());
            MesosNativeLibrary.load();
        }
        nativeLibraryLoaded = true;
    }

    // Default to root URL in Jenkins global configuration.
    String jenkinsRootURL = Jenkins.getInstance().getRootUrl();

    // If 'jenkinsURL' parameter is provided in mesos plugin configuration, then that should take precedence.
    if (StringUtils.isNotBlank(jenkinsURL)) {
        jenkinsRootURL = jenkinsURL;
    }

    // Restart the scheduler if the master has changed or a scheduler is not up.
    if (!master.equals(staticMaster) || !Mesos.getInstance(this).isSchedulerRunning()) {
        if (!master.equals(staticMaster)) {
            LOGGER.info("Mesos master changed, restarting the scheduler");
            staticMaster = master;
        } else {
            LOGGER.info("Scheduler was down, restarting the scheduler");
        }

        Mesos.getInstance(this).stopScheduler();
        Mesos.getInstance(this).startScheduler(jenkinsRootURL, this);
    } else {
        Mesos.getInstance(this).updateScheduler(jenkinsRootURL, this);
        LOGGER.info("Mesos master has not changed, leaving the scheduler running");
    }

}

From source file:org.opencastproject.capture.pipeline.GStreamerPipeline.java

/**
 * Creates the gStreamer pipeline and blocks until it starts successfully
 * //from  w ww . j a v a  2s.c  o m
 * @param newRec
 *          The RecordingImpl of the capture we wish to perform.
 * @return The recording ID (equal to newRec.getID()) or null in the case of an error
 */
public void start(RecordingImpl newRec) {
    // Create the pipeline
    try {
        pipeline = create(newRec.getProperties(), false);
    } catch (UnsatisfiedLinkError e) {
        throw new UnableToStartCaptureException(
                e.getMessage() + " : please add libjv4linfo.so to /usr/lib to correct this issue.");
    }

    // Check if the pipeline came up ok
    if (pipeline == null) {
        //logger.error("Capture {} could not start, pipeline was null!", newRec.getID());
        captureFailureHandler.resetOnFailure(newRec.getID());
        throw new UnableToStartCaptureException(
                "Capture " + newRec.getID() + " could not start, pipeline was null!");
    }

    logger.info("Initializing devices for capture.");

    hookUpBus();

    // Grab time to wait for pipeline to start
    int wait;
    String waitProp = newRec.getProperty(CaptureParameters.CAPTURE_START_WAIT);
    if (waitProp != null) {
        wait = Integer.parseInt(waitProp);
    } else {
        wait = 15; // Default taken from gstreamer docs
    }

    pipeline.debugToDotFile(Pipeline.DEBUG_GRAPH_SHOW_ALL, pipeline.getName());
    // Try and start the pipeline
    pipeline.play();
    if (pipeline.getState(wait * GStreamerPipeline.GST_SECOND) != State.PLAYING) {
        // In case of an error call stop to clean up the pipeline.  
        logger.debug("Pipeline was unable to start after " + wait + " seconds.");
        stop(GStreamerPipeline.DEFAULT_PIPELINE_SHUTDOWN_TIMEOUT);
        throw new UnableToStartCaptureException(
                "Unable to start pipeline after " + wait + " seconds.  Aborting!");
    }
    logger.info("{} started.", pipeline.getName());
}

From source file:org.tigris.subversion.svnclientadapter.javahl.JhlClientAdapterFactory.java

@SuppressWarnings("rawtypes")
public static boolean isAvailable() {
    if (!availabilityCached) {
        Class c = null;//from   ww w  .  j  av  a2 s.  c  o m
        try {
            // load a JavaHL class to see if it is found.  Do not use SVNClient as
            // it will try to load native libraries and we do not want that yet
            c = Class.forName("org.apache.subversion.javahl.ClientException");
            if (c == null)
                return false;
        } catch (Throwable t) {
            availabilityCached = true;
            return false;
        }
        // if library is already loaded, it will not be reloaded

        //workaround to solve Subclipse ISSUE #83
        // we will ignore these exceptions to handle scenarios where
        // javaHL was built diffently.  Ultimately, if javaHL fails to load
        // because of a problem in one of these libraries the proper behavior
        // will still occur -- meaning JavaHL adapter is disabled.
        if (isOsWindows()) {

            for (int i = 0; i < WINDOWSLIBS.length; i++) {
                try {
                    System.loadLibrary(WINDOWSLIBS[i]);
                } catch (Exception e) {
                    javaHLErrors.append(e.getMessage()).append("\n");
                } catch (UnsatisfiedLinkError e) {
                    javaHLErrors.append(e.getMessage()).append("\n");
                }
            }

        }
        //workaround to solve Subclipse ISSUE #83
        available = false;
        try {
            /*
             * see if the user has specified the fully qualified path to the native
             * library
             */
            try {
                String specifiedLibraryName = System.getProperty("subversion.native.library");
                if (specifiedLibraryName != null) {
                    System.load(specifiedLibraryName);
                    available = true;
                }
            } catch (UnsatisfiedLinkError ex) {
                javaHLErrors.append(ex.getMessage()).append("\n");
            }
            if (!available) {
                /*
                 * first try to load the library by the new name.
                 * if that fails, try to load the library by the old name.
                 */
                try {
                    System.loadLibrary("libsvnjavahl-1");
                } catch (UnsatisfiedLinkError ex) {
                    javaHLErrors.append(ex.getMessage() + "\n");
                    try {
                        System.loadLibrary("svnjavahl-1");
                    } catch (UnsatisfiedLinkError e) {
                        javaHLErrors.append(e.getMessage()).append("\n");
                        System.loadLibrary("svnjavahl");
                    }
                }

                available = true;
            }
        } catch (Exception e) {
            available = false;
            javaHLErrors.append(e.getMessage()).append("\n");
        } catch (UnsatisfiedLinkError e) {
            available = false;
            javaHLErrors.append(e.getMessage()).append("\n");
        } finally {
            availabilityCached = true;
        }
        if (!available) {
            String libraryPath = System.getProperty("java.library.path");
            if (libraryPath != null)
                javaHLErrors.append("java.library.path = " + libraryPath);
            // System.out.println(javaHLErrors.toString());
        } else {
            // At this point, the library appears to be available, but
            // it could be too old version of JavaHL library.  We have to try
            // to get the version of the library to be sure.
            try {
                ISVNClient svnClient = new SVNClient();
                Version version = svnClient.getVersion();
                if (version.getMajor() == 1 && version.getMinor() == 8)
                    available = true;
                else {
                    available = false;
                    javaHLErrors = new StringBuffer(
                            "Incompatible JavaHL library loaded.  Subversion 1.8.x required.");
                }
            } catch (UnsatisfiedLinkError e) {
                available = false;
                javaHLErrors = new StringBuffer(
                        "Incompatible JavaHL library loaded.  1.8.x or later required.");
            }
        }
    }

    return available;
}