Example usage for java.lang ClassNotFoundException getMessage

List of usage examples for java.lang ClassNotFoundException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.bangl.lm.LotManagerPlugin.java

public void saveLots(CommandSender sender) {
    try {//from   w w w.ja v a2s  . c  o m
        this.lots.save();
        sendInfo(sender, "Lots saved.");
    } catch (ClassNotFoundException e) {
        logError(e.getMessage());
        sendError(sender, e.getMessage());
    } catch (SQLException e) {
        logError(e.getMessage());
        sendError(sender, e.getMessage());
    }
}

From source file:de.bangl.lm.LotManagerPlugin.java

public void reloadLots(CommandSender sender) {
    try {//from  w w  w  . j av a2 s .  c om
        this.lots.load();
        sendInfo(sender, "Lots reloaded.");
    } catch (ClassNotFoundException e) {
        logError(e.getMessage());
        sendError(sender, e.getMessage());
    } catch (SQLException e) {
        logError(e.getMessage());
        sendError(sender, e.getMessage());
    }
}

From source file:de.bangl.lm.LotManagerPlugin.java

/**
 *
 *//*w  w w. j  av a  2s.com*/
@Override
public void onDisable() {
    try {
        this.getLogger().log(Level.INFO, "Saving WorldGuard regions...");
        this.wg.save();
        this.getLogger().log(Level.INFO, "Saving Lots...");
        this.lots.save();
        this.getLogger().log(Level.INFO, "Saving Signs...");
        saveSigns();
    } catch (ClassNotFoundException e) {
        logError(e.getMessage());
    } catch (SQLException e) {
        logError(e.getMessage());
    } catch (StorageException e) {
        logError(e.getMessage());
    }
}

From source file:com.intel.ssg.dcst.panthera.parse.SkinDriver.java

/**
 * Returns the hooks specified in a configuration variable.
 *
 * @param hookConfVar The configuration variable specifying a comma separated list of the hook
 *                    class names.//from  w w  w  .  j a v  a  2  s.  c  o  m
 * @param clazz       The super type of the hooks.
 * @return            A list of the hooks cast as the type specified in clazz, in the order
 *                    they are listed in the value of hookConfVar
 * @throws Exception
 */
private <T extends Hook> List<T> getHooks(ConfVars hookConfVar, Class<T> clazz) throws Exception {
    try {
        return HookUtils.getHooks(conf, hookConfVar, clazz);
    } catch (ClassNotFoundException e) {
        console.printError(hookConfVar.varname + " Class not found:" + e.getMessage());
        throw e;
    }
}

From source file:com.chiorichan.database.DatabaseEngine.java

/**
 * Initializes a sqLite connection./*from  w ww  .  ja  v  a 2s.  co  m*/
 * 
 * @param filename
 * @throws SQLException
 * @throws ClassNotFoundException
 */
public void init(String filename) throws SQLException {
    try {
        Class.forName("org.sqlite.JDBC");
    } catch (ClassNotFoundException e) {
        throw new StartupException(
                "We could not locate the 'org.sqlite.JDBC' library, be sure to have this library in your build path.");
    }

    File sqliteDb = new File(filename);

    if (!sqliteDb.exists()) {
        getLogger().warning("The SQLite file '" + sqliteDb.getAbsolutePath()
                + "' did not exist, we will attempt to create a blank one now.");
        try {
            sqliteDb.createNewFile();
        } catch (IOException e) {
            throw new SQLException(
                    "We had a problem creating the SQLite file, the exact exception message was: "
                            + e.getMessage(),
                    e);
        }
    }

    con = DriverManager.getConnection("jdbc:sqlite:" + sqliteDb.getAbsolutePath());

    getLogger().info("We succesully connected to the sqLite database using 'jdbc:sqlite:"
            + sqliteDb.getAbsolutePath() + "'");
    type = DBType.SQLITE;
}

From source file:org.ireland.jnetty.webapp.WebApp.java

/**
 * //from w w  w  .jav a 2  s . c  om
 * Filter
 * 
 * @param filterName
 * @param className
 * @param filterClass
 * @param filter
 * @return
 */
private FilterRegistration.Dynamic addFilter(String filterName, String className,
        Class<? extends Filter> filterClass, Filter filter) {

    try {
        FilterConfigImpl config = createNewFilterConfig();

        config.setFilterName(filterName);
        config.setFilterClass(className);

        if (filterClass != null)
            config.setFilterClass(filterClass);

        if (filter != null)
            config.setFilter(filter);

        addFilter(config);

        return config;
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        // spec declares no throws so far.
        throw new RuntimeException(e.getMessage(), e);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:org.apache.myfaces.custom.dojoaddresource.DojoAddResource.java

public void serveResource(ServletContext context, HttpServletRequest request, HttpServletResponse response)
        throws IOException {
    String pathInfo = request.getPathInfo();
    String uri = request.getContextPath() + request.getServletPath() + (pathInfo == null ? "" : pathInfo);
    String classNameStartsAfter = getResourceVirtualPath(context) + '/';

    int posStartClassName = uri.indexOf(classNameStartsAfter) + classNameStartsAfter.length();
    int posEndClassName = uri.indexOf(PATH_SEPARATOR, posStartClassName);
    String className = uri.substring(posStartClassName, posEndClassName);
    int posEndCacheKey = uri.indexOf(PATH_SEPARATOR, posEndClassName + 1);
    String resourceUri = null;//from  w w  w.  j  a  v a  2  s  .  co m
    if (posEndCacheKey + 1 < uri.length()) {
        resourceUri = uri.substring(posEndCacheKey + 1);
    }

    try {
        Class resourceLoader = getClass(className);
        validateResourceLoader(resourceLoader);
        ((ResourceLoader) resourceLoader.newInstance()).serveResource(context, request, response, resourceUri);
        // response.flushBuffer();
        // Do not call response.flushBuffer buffer here. There is no point, as if there
        // ever were header data to write, this would fail as we have already written
        // the response body. The only point would be to flush the output stream, but
        // that will happen anyway when the servlet container closes the socket.
        //
        // In addition, flushing could fail here; it appears that Microsoft IE
        // hasthe habit of hard-closing its socket as soon as it has received a complete
        // gif file, rather than letting the server close it. The container will hopefully
        // silently ignore exceptions on close.  
    } catch (ClassNotFoundException e) {
        log.error("Could not find class for name: " + className, e);
        sendError(response, HttpServletResponse.SC_NOT_FOUND,
                "Could not find resourceloader class for name: " + className);
    } catch (InstantiationException e) {
        log.error("Could not instantiate class for name: " + className, e);
        sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "Could not instantiate resourceloader class for name: " + className);
    } catch (IllegalAccessException e) {
        log.error("Could not access class for name: " + className, e);
        sendError(response, HttpServletResponse.SC_FORBIDDEN,
                "Could not access resourceloader class for name: " + className);
    } catch (IOException e) {
        logSend.error("Error while serving resource: " + resourceUri + ", message : " + e.getMessage(), e);
        sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    } catch (Throwable e) {
        log.error("Unknown error while serving resource: " + resourceUri + ", message : " + e.getMessage(), e);
        sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    }
}

From source file:org.apache.struts.taglib.html.BaseHandlerTag.java

private Integer getJstlLoopIndex() {
    if (!triedJstlInit) {
        triedJstlInit = true;//from w ww .  j av  a2 s  .co  m

        try {
            loopTagClass = RequestUtils.applicationClass("javax.servlet.jsp.jstl.core.LoopTag");

            loopTagGetStatus = loopTagClass.getDeclaredMethod("getLoopStatus", null);

            loopTagStatusClass = RequestUtils.applicationClass("javax.servlet.jsp.jstl.core.LoopTagStatus");

            loopTagStatusGetIndex = loopTagStatusClass.getDeclaredMethod("getIndex", null);

            triedJstlSuccess = true;
        } catch (ClassNotFoundException ex) {
            // These just mean that JSTL isn't loaded, so ignore
        } catch (NoSuchMethodException ex) {
        }
    }

    if (triedJstlSuccess) {
        try {
            Object loopTag = findAncestorWithClass(this, loopTagClass);

            if (loopTag == null) {
                return null;
            }

            Object status = loopTagGetStatus.invoke(loopTag, null);

            return (Integer) loopTagStatusGetIndex.invoke(status, null);
        } catch (IllegalAccessException ex) {
            log.error(ex.getMessage(), ex);
        } catch (IllegalArgumentException ex) {
            log.error(ex.getMessage(), ex);
        } catch (InvocationTargetException ex) {
            log.error(ex.getMessage(), ex);
        } catch (NullPointerException ex) {
            log.error(ex.getMessage(), ex);
        } catch (ExceptionInInitializerError ex) {
            log.error(ex.getMessage(), ex);
        }
    }

    return null;
}

From source file:kr.co.bitnine.octopus.meta.jdo.JDOMetaContext.java

@Override
public MetaDataSource addJdbcDataSource(String driverName, String connectionString, String name)
        throws MetaException {
    if (dataSourceExists(name))
        throw new MetaException("data source '" + name + "' already exists");

    // TODO: use another ClassLoader to load JDBC drivers
    LOG.debug("addJdbcDataSource. driverName=" + driverName + ", connectionString=" + connectionString
            + ", name=" + name);
    try {/*from w w w  .j a v  a2  s  . c o m*/
        Class.forName(driverName);
    } catch (ClassNotFoundException e) {
        throw new MetaException(e);
    }

    Transaction tx = pm.currentTransaction();
    Connection conn = null;
    try {
        conn = DriverManager.getConnection(connectionString);
        DataContext dc = DataContextFactory.createJdbcDataContext(conn);

        tx.begin();

        MDataSource mDataSource = new MDataSource(name, driverName, connectionString,
                MetaDataSource.DataSourceType.JDBC);
        pm.makePersistent(mDataSource);

        addDataSourceInternal(dc, mDataSource);

        tx.commit();

        LOG.debug("complete addJdbcDataSource");
        return mDataSource;
    } catch (MetaException me) {
        throw me;
    } catch (Exception e) {
        throw new MetaException("failed to add data source '" + name + "' - " + e.getMessage(), e);
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException ignore) {
            }
        }
        if (tx.isActive())
            tx.rollback();
    }
}