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:Exec.java

static Process execWindows(String[] cmdarray, String[] envp, File directory) throws IOException {
    if (envp != null || directory != null) {
        if (isJview())
            // jview doesn't support JNI, so can't call putenv/chdir
            throw new IOException("can't use Exec.exec() under Microsoft JVM");

        if (!linked) {
            try {
                System.loadLibrary("win32exec");
                linked = true;/*w  w w  .java 2s  .c o  m*/
            } catch (LinkageError e) {
                throw new IOException("can't use Exec.exec(): " + e.getMessage());
            }
        }

        if (envp != null) {
            for (int i = 0; i < envp.length; ++i)
                putenv(envp[i]);
        }

        if (directory != null)
            chdir(directory.toString());
    }

    return Runtime.getRuntime().exec(cmdarray);
}

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   w ww . j  a v  a  2  s  .  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;
}

From source file:com.comphenix.protocol.error.DetailedErrorReporter.java

/**
 * Retrieve a string representation of the given object.
 * @param value - object to convert.//w ww.ja  v  a 2 s  .co m
 * @return String representation.
 */
public static String getStringDescription(Object value) {
    // We can't only rely on toString.
    if (value == null) {
        return "[NULL]";
    }
    if (isSimpleType(value) || value instanceof Class<?>) {
        return value.toString();
    } else {
        try {
            if (!apacheCommonsMissing)
                return ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null);
        } catch (LinkageError ex) {
            // Apache is probably missing
            apacheCommonsMissing = true;
        } catch (ThreadDeath | OutOfMemoryError e) {
            throw e;
        } catch (Throwable ex) {
            // Don't use the error logger to log errors in error logging (that could lead to infinite loops)
            ProtocolLogger.log(Level.WARNING, "Cannot convert to a String with Apache: " + ex.getMessage());
        }

        // Use our custom object printer instead
        try {
            return PrettyPrinter.printObject(value, value.getClass(), Object.class);
        } catch (IllegalAccessException e) {
            return "[Error: " + e.getMessage() + "]";
        }
    }
}

From source file:org.neo4j.server.plugins.PluginManager.java

PluginManager(Configuration serverConfig, Iterable<ServerPlugin> plugins, StringLogger logger) {
    Map<String, Pair<ServerPlugin, ServerExtender>> extensions = new HashMap<String, Pair<ServerPlugin, ServerExtender>>();
    for (ServerPlugin plugin : plugins) {
        PluginPointFactory factory = new PluginPointFactoryImpl();
        final ServerExtender extender = new ServerExtender(factory);
        try {//from  w  w  w  . ja  va2 s.c  o m
            plugin.loadServerExtender(extender);
        } catch (Exception ex) {
            log.warn("Failed to load plugin [%s]: %s", plugin.toString(), ex.getMessage());
            if (logger != null)
                logger.logMessage("Failed to load plugin: " + plugin, ex);
            continue;
        } catch (LinkageError err) {
            log.warn("Failed to load plugin [%s]: %s", plugin.toString(), err.getMessage());
            if (logger != null)
                logger.logMessage("Failed to load plugin: " + plugin, err);
            continue;
        }
        Pair<ServerPlugin, ServerExtender> old = extensions.put(plugin.name, Pair.of(plugin, extender));
        if (old != null) {
            log.warn(String.format("Extension naming conflict \"%s\" between \"%s\" and \"%s\"", plugin.name,
                    old.first().getClass(), plugin.getClass()));
            if (logger != null)
                logger.logMessage(String.format("Extension naming conflict \"%s\" between \"%s\" and \"%s\"",
                        plugin.name, old.first().getClass(), plugin.getClass()));
        }
    }
    for (Pair<ServerPlugin, ServerExtender> extension : extensions.values()) {
        log.info(String.format("Loaded server plugin \"%s\"", extension.first().name));
        if (logger != null) {
            logger.logMessage(String.format("Loaded server plugin \"%s\" (%s)", extension.first().name,
                    extension.first().getClass().getName()));
            for (PluginPoint point : extension.other().all()) {
                logger.logMessage(String.format("  %s.%s: %s", point.forType().getSimpleName(), point.name(),
                        point.getDescription()));
            }
        }
        this.extensions.put(extension.first().name, extension.other());
    }
}

From source file:org.openhab.binding.pioneeravr.internal.handler.AbstractAvrHandler.java

/**
 * Initialize the state of the AVR./* w  w w  .  jav  a  2  s .c  o  m*/
 */
@Override
public void initialize() {
    logger.debug("Initializing handler for Pioneer AVR @{}", connection.getConnectionName());
    super.initialize();

    // Start the status checker
    Runnable statusChecker = new Runnable() {
        @Override
        public void run() {
            try {
                logger.debug("Checking status of AVR @{}", connection.getConnectionName());
                checkStatus();
            } catch (LinkageError e) {
                logger.warn(
                        "Failed to check the status for AVR @{}. If a Serial link is used to connect to the AVR, please check that the Bundle org.openhab.io.transport.serial is available. Cause: {}",
                        connection.getConnectionName(), e.getMessage());
                // Stop to check the status of this AVR.
                if (statusCheckerFuture != null) {
                    statusCheckerFuture.cancel(false);
                }
            }
        }
    };
    statusCheckerFuture = scheduler.scheduleWithFixedDelay(statusChecker, 1, 10, TimeUnit.SECONDS);
}

From source file:com.google.gsa.valve.rootAuth.RootAuthenticationProcess.java

/**
 * Sets the Valve Configuration instance to read the parameters 
 * from there/*from   ww w.  j  a  va 2  s  .co m*/
 * 
 * @param valveConf the Valve configuration instance
 */
public void setValveConfiguration(ValveConfiguration valveConf) {

    this.valveConf = valveConf;

    //Protection. Make sure the Map is empty before proceeding
    authenticationImplementations.clear();

    //Authentication process instance
    AuthenticationProcessImpl authenticationProcess = null;

    String repositoryIds[] = valveConf.getRepositoryIds();

    ValveRepositoryConfiguration repository = null;

    int order = 1;

    for (int i = 0; i < repositoryIds.length; i++) {
        try {

            repository = valveConf.getRepository(repositoryIds[i]);

            //Check if repository has to be included in the authentication process. By default set it to true
            boolean checkAuthN = true;
            try {
                if ((repository.getCheckAuthN() != null) && (!repository.getCheckAuthN().equals(""))) {
                    checkAuthN = new Boolean(repository.getCheckAuthN()).booleanValue();
                }
            } catch (Exception e) {
                logger.error("Error when reading checkAuthN param: " + e.getMessage(), e);
                //protection
                checkAuthN = true;
            }

            if (checkAuthN) {
                logger.info(
                        "Initialising authentication process for " + repository.getId() + " [#" + order + "]");
                authenticationProcess = (AuthenticationProcessImpl) Class.forName(repository.getAuthN())
                        .newInstance();
                authenticationProcess.setValveConfiguration(valveConf);
                //add this authentication process to the Map
                synchronized (authenticationImplementations) {
                    synchronized (authenticationImplementations) {
                        authenticationImplementations.put(repository.getId(), authenticationProcess);
                        authenticationImplementationsOrder.put(new Integer(order), repository.getId());
                        order++;
                    }
                }

            } else {
                logger.debug("Authentication process for repository [" + repository.getId()
                        + "] is not going to be launched");
            }

        } catch (LinkageError le) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthenticationProcess-LinkageError]: " + le.getMessage(),
                    le);
        } catch (InstantiationException ie) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthenticationProcess-InstantiationException]: "
                    + ie.getMessage(), ie);
        } catch (IllegalAccessException iae) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthenticationProcess-IllegalAccessException]: "
                    + iae.getMessage(), iae);
        } catch (ClassNotFoundException cnfe) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthenticationProcess-ClassNotFoundException]: "
                    + cnfe.getMessage(), cnfe);
        } catch (Exception e) {
            logger.error(repository.getId() + " - Can't instantiate class [AuthenticationProcess-Exception]: "
                    + e.getMessage(), e);
        }
    }
    logger.debug(RootAuthenticationProcess.class.getName() + " initialised");
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration.java

private void configureSpringJtaPlatform(Map<String, Object> vendorProperties,
        JtaTransactionManager jtaTransactionManager) {
    try {/*from w w  w .  j a v a  2 s.c  o m*/
        vendorProperties.put(JTA_PLATFORM, new SpringJtaPlatform(jtaTransactionManager));
    } catch (LinkageError ex) {
        // NoClassDefFoundError can happen if Hibernate 4.2 is used and some
        // containers (e.g. JBoss EAP 6) wraps it in the superclass LinkageError
        if (!isUsingJndi()) {
            throw new IllegalStateException("Unable to set Hibernate JTA "
                    + "platform, are you using the correct " + "version of Hibernate?", ex);
        }
        // Assume that Hibernate will use JNDI
        if (logger.isDebugEnabled()) {
            logger.debug("Unable to set Hibernate JTA platform : " + ex.getMessage());
        }
    }
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.java

private void configureSpringJtaPlatform(Map<String, Object> vendorProperties,
        JtaTransactionManager jtaTransactionManager) {
    try {/*from w  w w . ja v  a2  s. co m*/
        vendorProperties.put(JTA_PLATFORM, new SpringJtaPlatform(jtaTransactionManager));
    } catch (LinkageError ex) {
        // NoClassDefFoundError can happen if Hibernate 4.2 is used and some
        // containers (e.g. JBoss EAP 6) wrap it in the superclass LinkageError
        if (!isUsingJndi()) {
            throw new IllegalStateException("Unable to set Hibernate JTA "
                    + "platform, are you using the correct " + "version of Hibernate?", ex);
        }
        // Assume that Hibernate will use JNDI
        if (logger.isDebugEnabled()) {
            logger.debug("Unable to set Hibernate JTA platform : " + ex.getMessage());
        }
    }
}

From source file:com.google.gsa.valve.rootAuth.RootAuthorizationProcess.java

/**
 * Gets the authorization process instance needed to process the request
 * //from   www  . j  av  a 2s . c o m
 * @param repository the repository configuration information
 * 
 * @return the authorization class 
 */
private AuthorizationProcessImpl getAuthorizationProcess(ValveRepositoryConfiguration repository) {

    AuthorizationProcessImpl authProcess = null;

    //protection
    if (repository != null) {

        try {

            String authZComponent = repository.getAuthZ();
            logger.debug("Authorization module is: " + authZComponent);

            if (authZComponent != null) {
                authProcess = (AuthorizationProcessImpl) Class.forName(authZComponent).newInstance();
                authProcess.setValveConfiguration(valveConf);
            } else {
                logger.debug("This repository[" + repository.getId()
                        + "] does not cointain any Authorization class");
            }

        } catch (LinkageError le) {
            logger.error(repository.getId() + " - Can't instantiate class [AuthorizationProcess-LinkageError]: "
                    + le.getMessage(), le);
            authProcess = null;
        } catch (InstantiationException ie) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthorizationProcess-InstantiationException]: "
                    + ie.getMessage(), ie);
            authProcess = null;
        } catch (IllegalAccessException iae) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthorizationProcess-IllegalAccessException]: "
                    + iae.getMessage(), iae);
            authProcess = null;
        } catch (ClassNotFoundException cnfe) {
            logger.error(repository.getId()
                    + " - Can't instantiate class [AuthorizationProcess-ClassNotFoundException]: "
                    + cnfe.getMessage(), cnfe);
            authProcess = null;
        } catch (Exception e) {
            logger.error(repository.getId() + " - Can't instantiate class [AuthorizationProcess-Exception]: "
                    + e.getMessage(), e);
            authProcess = null;
        }
    }

    return authProcess;
}

From source file:er.directtoweb.pages.ERD2WListPage.java

/**
 * Attempts to instantiate the custom edit object delegate subclass, if one has been specified.
 *///from   w  ww .j  a  va2  s  .c  om
private ERDEditObjectDelegate editObjectDelegateInstance() {
    ERDEditObjectDelegate delegate = null;
    String delegateClassName = (String) d2wContext().valueForKey("editObjectDelegateClass");
    if (delegateClassName != null) {
        try {
            Class delegateClass = Class.forName(delegateClassName);
            Constructor delegateClassConstructor = delegateClass.getConstructor(WOContext.class);
            delegate = (ERDEditObjectDelegate) delegateClassConstructor.newInstance(context());
        } catch (LinkageError le) {
            if (le instanceof ExceptionInInitializerError) {
                log.warn("Could not initialize edit object delegate class: " + delegateClassName);
            } else {
                log.warn(
                        "Could not load  delegate class: " + delegateClassName + " due to: " + le.getMessage());
            }
        } catch (ClassNotFoundException cnfe) {
            log.warn("Could not find class for edit object delegate: " + delegateClassName);
        } catch (NoSuchMethodException nsme) {
            log.warn("Could not find constructor for edit object delegate class: " + delegateClassName);
        } catch (SecurityException se) {
            log.warn(
                    "Insufficient privileges to access edit object delegate constructor: " + delegateClassName);
        } catch (IllegalAccessException iae) {
            log.warn("Insufficient access to create edit object delegate instance: " + iae.getMessage());
        } catch (IllegalArgumentException iae) {
            log.warn("Used an illegal argument when creating edit object delegate instance: "
                    + iae.getMessage());
        } catch (InstantiationException ie) {
            log.warn("Could not instantiate edit object delegate instance: " + ie.getMessage());
        } catch (InvocationTargetException ite) {
            log.warn("Exception while invoking edit object delegate constructor: " + ite.getMessage());
        }
    }

    return delegate;
}