Example usage for java.lang LinkageError getMessage

List of usage examples for java.lang LinkageError getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.graphwalker.ModelBasedTesting.java

protected void executePath(String strClassName) throws InterruptedException {
    if (getJavaExecutorClass() == null) {
        setJavaExecutorClass(strClassName);
    }/*from  w  ww.j  ava 2 s .  c  om*/

    if (isDryRun()) {
        logger.debug("Executing a dry run");
        executePath(null, null);
    } else {
        logger.debug("Executing a non-dry run");
    }

    if (strClassName == null || strClassName.trim().equals(""))
        throw new RuntimeException("Needed execution class name is missing as parameter.");
    Class<?> clsClass = null;

    logger.debug("Trying to get a class for name: " + strClassName);
    try {
        clsClass = Class.forName(strClassName);
        logger.debug("Got class for name: " + strClassName);
    } catch (LinkageError e) {
        String str = "Could not load class: " + e.getMessage() + "\nProblem occured when loading class: "
                + strClassName + ".\n Current class path is: " + System.getProperty("java.class.path");
        logger.error(str);
        Util.logStackTraceToError(e);
        throw new RuntimeException(str, e);
    } catch (ClassNotFoundException e) {
        String str = "Could not load class: " + strClassName + ".\n Current class path is: "
                + System.getProperty("java.class.path");
        logger.error(str);
        throw new RuntimeException(str, e);
    }
    executePath(clsClass, null);
}

From source file:stg.pr.engine.CProcessRequestEngine.java

/**
 * Instantiate an object of the class, mentioned in the process_class_nm
 * field of the PROCESS_REQUEST table.//  ww  w.ja  va2  s  .  c o  m
 * 
 * This class is loaded using a custom classloader that loads the latest
 * version of the class file from disk. The new object is then cast to
 * IProcessRequest. If the cast fails an appropriate exception is logged in
 * the Engine and Request Log
 * 
 * @param pstrClassName
 *            Class name to be instantiated.
 * @return An object reference to IProcessRequest interface
 * @throws LinkageError
 * @throws CProcessRequestEngineException
 *             when instantiation or casting fails
 * 
 */
private ProcessRequestServicer instantiateReqProcessObject(String pstrClassName)
        throws LinkageError, CProcessRequestEngineException {

    ProcessRequestServicer objProcessRequest = null;

    try {

        long lLoadingClassStartTime = System.currentTimeMillis();
        ClassLoader pcl = (CCustomClassLoaderFactory.getInstance()).getClassLoader(this);

        if (objEngineLogger_.isDebugEnabled()) {
            objEngineLogger_.debug("Loading PRE class " + pstrClassName);
        }

        Class<?> objClass = pcl.loadClass(pstrClassName);
        long lLoadingClassEndTime = System.currentTimeMillis();
        if (objEngineLogger_.isEnabledFor(LogLevel.FINER)) {
            objEngineLogger_.log(LogLevel.FINER, "Loaded PRE " + objClass);
        }
        if (objEngineLogger_.isEnabledFor(LogLevel.FINE)) {
            objEngineLogger_.log(LogLevel.FINE, "{2}Elapsed Time to Load Class " + objClass + " #"
                    + (lLoadingClassEndTime - lLoadingClassStartTime));
        }
        Object obj = objClass.newInstance();
        if (objEngineLogger_.isEnabledFor(LogLevel.FINE)) {
            objEngineLogger_.log(LogLevel.FINE, "{3}Elapsed Time to instantiate Class " + objClass + " #"
                    + (System.currentTimeMillis() - lLoadingClassEndTime));
        }

        if (obj instanceof ProcessRequestServicer) {
            objProcessRequest = (ProcessRequestServicer) obj;
        } else {
            throw new CProcessRequestEngineException(
                    "The business object in the request does not implement IProcessRequest");
        }

    } catch (LinkageError le) {
        objEngineLogger_.error(le.getMessage(), le);
        throw le;
    } catch (Exception e) {
        objEngineLogger_.error(e.getMessage(), e);
        throw new CProcessRequestEngineException(e.getMessage());
    } finally {

    }

    return objProcessRequest;
}