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:jp.eisbahn.oauth2.server.spi.servlet.TokenServlet.java

/**
 * Initialize this servlet.//from  w w  w .  j a  v a2  s. c o  m
 * For instance, this method loads three implementation class name and create
 * these instances. Then, the Token instance to process the
 * OAuth 2.0 grant execution for the request is created with their helper instances.
 * 
 * @param config The ServletConfig object.
 * @exception ServletException Each helper instance could not be created.
 */
@Override
public void init(ServletConfig config) throws ServletException {
    try {
        DataHandlerFactory dataHandlerFactory = getDataHandlerFactory(config);
        GrantHandlerProvider grantHandlerProvider = getGrantHandlerProvider(config);
        ClientCredentialFetcher clientCredentialFetcher = getClientCredentialFetcher(config);
        token = new Token();
        token.setDataHandlerFactory(dataHandlerFactory);
        token.setGrantHandlerProvider(grantHandlerProvider);
        token.setClientCredentialFetcher(clientCredentialFetcher);
    } catch (ClassNotFoundException e) {
        throw new ServletException(e.getMessage(), e);
    } catch (InstantiationException e) {
        throw new ServletException(e.getMessage(), e);
    } catch (IllegalAccessException e) {
        throw new ServletException(e.getMessage(), e);
    }
}

From source file:net.freedom.gj.beans.config.SpringXmlMapperConfiguration.java

/**
 * The criteria is the source object type has to be of sourceType
 * and target object type has to be of type targetType.
 * @return//from  w  ww  . ja  va 2s.  c om
 */
public List<PropertyCriteria> getCriteria() {
    try {
        PropertyBuilder pb = new PropertyBuilder()
                .build("source", new InstanceOfMatcher(Class.forName(sourceType)))
                .build("target", new InstanceOfMatcher(Class.forName(targetType)));
        if (additionalCriteria != null && !additionalCriteria.isEmpty()) {
            for (String property : additionalCriteria.keySet()) {
                pb.build(property, additionalCriteria.get(property));
            }
        }
        return new CriteriaBuilder().build(pb).getCriteria();
    } catch (ClassNotFoundException e) {
        throw new IllegalArgumentException(e.getMessage());
    }
}

From source file:DedicatedConnectionServlet.java

public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {// w w w.  j a  v  a 2  s  .  c o m
        // load the driver
        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    } catch (ClassNotFoundException e) {
        throw new UnavailableException("DedicatedConnection.init() ClassNotFoundException: " + e.getMessage());
    } catch (IllegalAccessException e) {
        throw new UnavailableException("DedicatedConnection.init() IllegalAccessException: " + e.getMessage());
    } catch (InstantiationException e) {
        throw new UnavailableException("DedicatedConnection.init() InstantiationException: " + e.getMessage());
    }

    try {
        // establish a connection
        connection = DriverManager.getConnection("jdbc:oracle:thin:@dssw2k01:1521:orcl", "scott", "tiger");
        connected = System.currentTimeMillis();
    } catch (SQLException e) {
        throw new UnavailableException("DedicatedConnection.init() SQLException: " + e.getMessage());
    }
}

From source file:JDBCServlet.java

public void doGet(HttpServletRequest inRequest, HttpServletResponse outResponse)
        throws ServletException, IOException {

    PrintWriter out = null;/* w  w w  .  j a va  2s. c  o m*/
    Connection connection = null;
    Statement statement;
    ResultSet rs;

    try {
        Class.forName("com.mysql.jdbc.Driver");

        connection = DriverManager.getConnection("jdbc:mysql://localhost/products");
        statement = connection.createStatement();

        outResponse.setContentType("test/html");
        out = outResponse.getWriter();

        rs = statement.executeQuery("SELECT ID, title, price FROM product");

        out.println("<HTML><HEAD><TITLE>Products</TITLE></HEAD>");
        out.println("<BODY>");
        out.println("<UL>");

        while (rs.next()) {
            out.println(
                    "<LI>" + rs.getString("ID") + " " + rs.getString("title") + " " + rs.getString("price"));
        }

        out.println("</UL>");
        out.println("</BODY></HTML>");
    } catch (ClassNotFoundException e) {
        out.println("Driver Error");
    } catch (SQLException e) {
        out.println("SQLException: " + e.getMessage());
    }
}

From source file:namedatabasescraper.NameDatabaseScraper.java

private void attachDatabase()
        throws CannotLoadJDBCDriverException, SQLException, IOException, ErrorCreatingDatabaseException {
    try {// ww  w .j  a va2s. c om
        Class.forName("org.sqlite.JDBC");
    } catch (ClassNotFoundException ex) {
        logger.log(Level.SEVERE, "Could not load SQLite JDBC driver: {0}", ex.getMessage());
        throw new CannotLoadJDBCDriverException();
    }
    String dbFilename = this.settingsDirname + File.separator + "names.sqlite";
    File dbFile = new File(dbFilename);
    this.connection = DriverManager.getConnection("jdbc:sqlite:" + dbFilename);
    Statement statement = this.connection.createStatement();

    try {
        ResultSet rs = statement.executeQuery("SELECT name FROM names LIMIT 1");
        while (rs.next()) {
            //lastProgramRun = rs.getString("value");
        }
    } catch (SQLException e) {
        logger.log(Level.INFO, "Creating new name table");
        statement.execute("CREATE TABLE names (name TEXT, scraper_id TEXT)");
    }
}

From source file:com.kumarvv.setl.utils.RowSetUtil.java

protected boolean loadDriver(DS ds) {
    if (ds == null || StringUtils.isEmpty(ds.getUrl())) {
        return false;
    }/*from  w ww . j  a v  a 2s. c o m*/

    String driver = "";
    if (ds.getUrl().contains("oracle")) {
        driver = "oracle.jdbc.driver.OracleDriver";
    } else if (ds.getUrl().contains("mysql")) {
        driver = "com.mysql.jdbc.Driver";
    } else {
        Logger.error("Datasource vendor not supported: " + ds.getUrl());
        return false;
    }

    try {
        loadDriverClass(driver);
    } catch (ClassNotFoundException cnfe) {
        Logger.error("Oracle JDBC Driver could not be loaded: " + cnfe.getMessage());
        return false;
    }
    return true;
}

From source file:com.setronica.ucs.server.MsgPackUCSCoreService.java

public ServiceOperationResult execute(ServiceOperation serviceOperation) throws LocalizableException {
    RemoteService remoteService = (RemoteService) applicationContext.getBean(serviceOperation.serviceName);
    try {/*  w  ww  .  ja  va2  s  .c om*/
        Operation operation = deserialize(serviceOperation.operation);
        OperationResult operationResult = remoteService.execute(operation);
        ServiceOperationResult serviceOperationResult = new ServiceOperationResult();
        serviceOperationResult.result = serialize(operationResult);
        return serviceOperationResult;
    } catch (ClassNotFoundException e) {
        throw new LocalizableException(ErrorCode.Service_UnknownOperation,
                new Message("unexpected.operation.0", e.getMessage()));
    } catch (Exception e) {
        throw new LocalizableException(e, ErrorCode.InternalError,
                new Message("operation.execution.exception"));
    }
}

From source file:de.unibayreuth.bayeos.goat.table.OctetMatrixTableModel.java

private void readStream(InputStream in, Vector objekts) throws IOException {
    int von = 0;//  ww w  . j  ava  2 s .  c  o  m
    rowCount = 0;
    ObjectInputStream oin = new ObjectInputStream(in);
    try {
        while (true) {
            vonList.add(oin.readInt());
            for (int c = 0; c < objekts.size(); c++) {
                wertList.add(oin.readObject());
            }
            rowCount++;
        }
    } catch (EOFException i) {
        if (logger.isDebugEnabled()) {
            logger.debug("Stream with " + rowCount + " rows red.");
        }
    } catch (ClassNotFoundException e) {
        logger.error(e.getMessage());
    }

}

From source file:jp.eisbahn.oauth2.server.spi.servlet.ProtectedResourceFilter.java

/**
 * Initialize this filter./*w w w.  j  av a2s .  co  m*/
 * For instance, this method loads two implementation class name and create
 * these instances. Then, the ProtectedResource instance to process the
 * OAuth 2.0 validation for the request is created with their helper instances.
 * 
 * @param config The FilterConfig object.
 * @exception ServletException Each helper instance could not be created.
 */
@Override
public void init(FilterConfig config) throws ServletException {
    try {
        DataHandlerFactory dataHandlerFactory = getDataHandlerFactory(config);
        AccessTokenFetcherProvider accessTokenFetcherProvider = getAccessTokenFetcherProvider(config);
        protectedResource = new ProtectedResource();
        protectedResource.setDataHandlerFactory(dataHandlerFactory);
        protectedResource.setAccessTokenFetcherProvider(accessTokenFetcherProvider);
    } catch (ClassNotFoundException e) {
        throw new ServletException(e.getMessage(), e);
    } catch (InstantiationException e) {
        throw new ServletException(e.getMessage(), e);
    } catch (IllegalAccessException e) {
        throw new ServletException(e.getMessage(), e);
    }
}

From source file:com.jroossien.boxx.nms.NMS.java

public <T> Object loadFromNMS(Class<T> dep) {
    if (!dep.isAnnotationPresent(NMSDependant.class))
        return null;
    NMSDependant nmsDependant = dep.getAnnotation(NMSDependant.class);
    Class<?> impl = null;//from   www.  java2 s  .co m
    try {
        impl = Class.forName(nmsDependant.implementationPath() + "." + dep.getSimpleName() + "_" + version);
        return impl.newInstance();
    } catch (ClassNotFoundException e) {
        Boxx.get().error("The current version is not supported: " + version + ".\n" + e.getMessage());
    } catch (InstantiationException | IllegalAccessException e) {
        e.printStackTrace();
    }
    return impl;
}