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:com.sun.portal.os.portlets.ChartServlet.java

private Connection getDatabaseConnection(HttpServletRequest request)
        throws SQLException, NoPreferredDbSetException {
    HttpSession session = request.getSession(true);
    PortletPreferences prefs = (PortletPreferences) session.getAttribute("PORTLET_PREFERENCES");

    if (prefs == null)
        throw new NoPreferredDbSetException("No Preferences Set.. Don't know what DB to connect to");

    String driverUrl = prefs.getValue(Constants.PREF_JDBC_DRIVER_URL, JDBC_URL);
    String driverClass = prefs.getValue(Constants.PREF_JDBC_DRIVER_CLASS, MYSQL_JDBC_DRIVER);

    debugMessage("Driver Class: " + driverClass);
    debugMessage("Driver URL : " + driverUrl);

    try {/*www.j a  v  a  2s  . c  o m*/
        Class.forName(driverClass);
    } catch (ClassNotFoundException e) {
        System.err.print("ClassNotFoundException: ");
        System.err.println(e.getMessage());
    }
    return DriverManager.getConnection(driverUrl);
}

From source file:org.geoserver.geofence.gui.server.service.impl.LoginService.java

public UserModel authenticate(String userName, String password, HttpSession session)
        throws ApplicationException {
    logger.info("Authenticating '" + userName + "'");

    GrantedAuths grantedAuths = null;//from   ww  w. java  2  s .c  o  m
    String token = null;

    try {
        URL url = Class.forName("org.geoserver.geofence.gui.client.UserUI").getResource("client.keystore");
        String path = url.getPath();
        if (logger.isDebugEnabled()) {
            logger.debug(path);
        }
        System.setProperty("javax.net.ssl.trustStore", path);
        System.setProperty("javax.net.ssl.trustStorePassword", "geosolutions");

        GFUser matchingUser = null;

        // a backdoor!?! :o
        if (userName.equals("1nt3rnAL-G30r3p0-admin")) {
            matchingUser = new GFUser();
            matchingUser.setName(userName);
            matchingUser.setPassword("2c6fe6e260312c5aa94ef0ca42b0af");
        } else {
            try {
                matchingUser = geofenceRemoteService.getGfUserAdminService().get(userName);
            } catch (NotFoundServiceEx ex) {
                logger.warn("User not found");
                throw new ApplicationException("Login failed");
            }
            //                // grantedAuthorities =
            //                List<GFUser> matchingUsers = geofenceRemoteService.getGfUserAdminService().getFullList(userName, null,
            //                        null);
            //                logger.info(matchingUsers);
            //                logger.info(matchingUsers.size());
            //
            //                if ((matchingUsers == null) || matchingUsers.isEmpty() || (matchingUsers.size() != 1))
            //                {
            //                    logger.error("Error :********** " + "Invalid username specified!");
            //                    throw new ApplicationException("Error :********** " + "Invalid username specified!");
            //                }
            //
            //                logger.info(matchingUsers.get(0).getName());
            //                logger.info(matchingUsers.get(0).getPassword());
            //                logger.info(matchingUsers.get(0).getEnabled());
            //
            //                if (!matchingUsers.get(0).getName().equals(userName) || !matchingUsers.get(0).getEnabled())
            //                {
            //                    logger.error("Error :********** " + "The specified user does not exist!");
            //                    throw new ApplicationException("Error :********** " + "The specified user does not exist!");
            //                }
            //
            //                matchingUser = matchingUsers.get(0);
        }

        token = geofenceRemoteService.getLoginService().login(userName, password, matchingUser.getPassword());
        grantedAuths = geofenceRemoteService.getLoginService().getGrantedAuthorities(token);

    } catch (ClassNotFoundException e) {
        logger.error("Error :********** " + e.getMessage());
        throw new ApplicationException(e);
    } catch (AuthException e) {
        logger.error("Login failed");
        throw new ApplicationException(e.getMessage(), e);
    }

    UserModel user = new UserModel();
    user.setName(userName);
    user.setPassword(password);

    // convert the server-side auths to client-side auths
    List<Authorization> guiAuths = new ArrayList<Authorization>();
    for (Authority auth : grantedAuths.getAuthorities()) {
        guiAuths.add(Authorization.valueOf(auth.name()));
    }
    user.setGrantedAuthorizations(guiAuths);

    if ((grantedAuths != null) && !grantedAuths.getAuthorities().isEmpty()) {
    }

    session.setMaxInactiveInterval(7200);

    session.setAttribute(GeofenceKeySessionValues.USER_LOGGED_TOKEN.getValue(), token);
    /* session.setAttribute(GeofenceKeySessionValues.USER_LOGGED_TOKEN.getValue(),
        grantedAuthorities_NOTUSEDANYMORE.getToken()); */

    return user;
}

From source file:net.mypapit.mobile.myrepeater.RepeaterHistoryActivity.java

@SuppressWarnings("unchecked")
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.repeater_list);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }/* w w w  .  j  a  v a 2 s.  c  om*/

    Intent intent = this.getIntent();
    ArrayList<Repeater> al = (ArrayList<Repeater>) intent.getExtras().get("historylist");

    double lat = intent.getExtras().getDouble("lat");
    double lon = intent.getExtras().getDouble("lon");

    if (al == null) {
        al = new ArrayList<Repeater>();
        Log.d("net.mypapit.mobile", "null Array List");
    }

    // RepeaterList rl = new RepeaterList();

    try {
        File infile = new File(Environment.getExternalStorageDirectory(), "history.txt");
        FileInputStream fis = new FileInputStream(infile);

        ObjectInputStream ois = new ObjectInputStream(fis);

        stackhistory = (StackHistory) ois.readObject();
        ois.close();
    } catch (IOException ioex) {
        stackhistory = new StackHistory();
        Log.d("net.mypapit.mobile", ioex.getMessage());
        ioex.printStackTrace(System.err);

    } catch (ClassNotFoundException cnfe) {
        stackhistory = new StackHistory();
        Log.d("net.mypapit.mobile", cnfe.getMessage());
        cnfe.printStackTrace(System.err);
    }
    RepeaterList rl = new RepeaterList(stackhistory);
    // rl.add(new Repeater("sux", "sux", "sux", "sux", "sux", 0, 0, 0, 0,
    // 0));
    Repeater repeater = new Repeater("unknown", lat, lon);
    repeater.calcDistanceAll(rl);
    // rl.sort();

    lv = (ListView) findViewById(R.id.repeaterListView);
    tvAddress = (TextView) findViewById(R.id.tvAddress);
    tvAddress.setText("Recently searched repeater");

    adapter = new RepeaterAdapter(this, rl, 100, false);

    lv.setAdapter(adapter);

}

From source file:org.onesun.atomator.adaptors.AdaptorFactory.java

private void parseDocument(Document document) {
    Element element = document.getDocumentElement();

    NodeList updates = element.getElementsByTagName("entry");
    if (updates != null && updates.getLength() > 0) {
        logger.info("Reading adaptors.xml : loading #" + updates.getLength() + " adaptors");
        for (int index = 0; index < updates.getLength(); index++) {
            Element item = (Element) updates.item(index);

            try {
                String identity = XMLUtils.getValue(item, "identity");
                String adaptorName = XMLUtils.getValue(item, "adaptor");

                NodeList feedUrls = item.getElementsByTagName("feedURL");
                if (feedUrls != null && feedUrls.getLength() > 0) {
                    Set<String> uriSet = null;

                    uriSet = urlEntries.get(identity);
                    if (uriSet == null) {
                        uriSet = new HashSet<String>();
                    }//from w w w  .  j  a  va  2 s  .c  om

                    for (int findex = 0; findex < feedUrls.getLength(); findex++) {
                        Element feedURL = (Element) feedUrls.item(findex);

                        uriSet.add(feedURL.getTextContent());
                    }

                    urlEntries.put(identity, uriSet);
                }

                Class<?> clazz = (Class<?>) Class.forName(adaptorName);
                logger.info("Loaded class for adaptor: " + adaptorName);

                adaptors.put(identity, clazz);
            } catch (ClassNotFoundException e) {
                logger.error("Class Not Found Exception while loading adaptors : " + e.getMessage());
            }
        }
    }
}

From source file:gridool.db.partitioning.monetdb.MonetDBCopyIntoOperation.java

@Override
public Serializable execute() throws SQLException {
    final Connection conn;
    try {/*from  w  w  w .  j ava 2s .  c om*/
        conn = getConnection();
    } catch (ClassNotFoundException e) {
        LOG.error(e);
        throw new SQLException(e.getMessage());
    }
    if (createTableDDL != null) {// prepare a table
        try {
            JDBCUtils.update(conn, createTableDDL);
        } catch (SQLException e) {
            conn.rollback();
            if (LOG.isDebugEnabled()) {
                LOG.debug("Table already exists. Try to truncate " + tableName, e);
            }
            truncateTable(conn, tableName);
            // fall through
        }
    }

    final File loadFile = prepareLoadFile(tableName, rowsData);
    this.rowsData = null;
    final String query = complementCopyIntoQuery(copyIntoQuery, loadFile);
    try {
        JDBCUtils.update(conn, query);
        conn.commit();
    } catch (SQLException e) {
        LOG.error("rollback a transaction", e);
        conn.rollback();
        throw e;
    } finally {
        try {
            conn.close();
        } catch (SQLException e) {
            LOG.debug(e);
        }
        if (!loadFile.delete()) {
            LOG.warn("Could not remove a tempolary file: " + loadFile.getAbsolutePath());
        }
    }

    return Boolean.TRUE;
}

From source file:com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementActionConfigTransformer.java

public List<ServiceLevelAgreementActionValidation> validateAction(String actionConfigurationClassName) {
    List<ServiceLevelAgreementActionValidation> validation = null;
    try {/*from w ww . j a v  a  2s .co  m*/
        Class<? extends ServiceLevelAgreementActionConfiguration> configurationClass = ClassNameChangeRegistry
                .findClass(actionConfigurationClassName);
        ServiceLevelAgreementActionConfig annotation = (ServiceLevelAgreementActionConfig) configurationClass
                .getAnnotation(ServiceLevelAgreementActionConfig.class);
        Class<? extends ServiceLevelAgreementAction>[] actions = annotation.actionClasses();
        if (actions != null) {
            List<Class<? extends ServiceLevelAgreementAction>> actionClassList = Lists.newArrayList(actions);
            validation = ServiceLevelAgreementActionUtil.validateActionConfiguration(actionClassList);
        } else {
            validation.add(new ServiceLevelAgreementActionValidation(false,
                    "No Actions are defined for :" + actionConfigurationClassName));
        }

    } catch (ClassNotFoundException e) {
        validation.add(new ServiceLevelAgreementActionValidation(false,
                "ImmutableAction Configuration Not Found: " + e.getMessage()));
    }

    return validation;

}

From source file:gov.nih.nci.cabig.caaers.tools.ObjectDump.java

public int doStartTag() throws JspException {
    out = pageContext.getOut();//from   w ww  .ja v  a  2  s . c o  m

    Class cls = null;
    Field[] fields;

    try {
        cls = Class.forName(target.getClass().getName());
    } catch (ClassNotFoundException e) {
        log.error("Class <" + target.getClass().getName() + "> not found.");
    }

    try {
        out.write("<pre>");
        out.write("</pre>");
    } catch (IOException e) {
        log.error("Error." + e.getMessage());
    }
    return super.doStartTag();
}

From source file:cherry.foundation.testtool.stub.StubServiceImpl.java

private String execute(String className, String methodName, int methodIndex,
        Function<Method, String> function) {
    try {// ww  w . j a  va 2 s  .  c om
        List<Method> list = reflectionResolver.resolveMethod(className, methodName);
        if (methodIndex >= list.size()) {
            return String.valueOf(false);
        }
        return function.apply(list.get(methodIndex));
    } catch (ClassNotFoundException ex) {
        return ex.getMessage();
    }
}

From source file:com.clustercontrol.sql.util.AccessDB.java

/**
 * DB???/*  w w w .  jav a  2  s. co  m*/
 *
 * @throws SQLException
 * @throws ClassNotFoundException
 */
private void initial() throws SQLException, ClassNotFoundException {
    //JDBC??
    try {
        Class.forName(m_jdbcDriver);
    } catch (ClassNotFoundException e) {
        m_log.info("initial() : " + e.getClass().getSimpleName() + ", " + e.getMessage());
        throw e;
    }

    Properties prop = jdbcProps.getProperties();
    prop.put("user", m_user);
    prop.put("password", m_password);

    try {
        if (jdbcProps.isLoginTimeoutEnable()) {
            DriverManager.setLoginTimeout(jdbcProps.getLoginTimeout());
            m_log.debug(
                    "enabled loginTimeout (" + jdbcProps.getLoginTimeout() + " [sec]) for \"" + m_url + "\".");
        } else {
            m_log.debug("disabled loginTimeout for \"" + m_url + "\".");
        }
        m_connection = DriverManager.getConnection(m_url, prop);

        //SQL????Statement?
        m_statement = m_connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_READ_ONLY);

    } catch (SQLException e) {
        m_log.info("initial() database access failure : url = " + m_url + ", : " + e.getClass().getSimpleName()
                + ", " + e.getMessage());
        try {
            if (m_statement != null)
                m_statement.close();
        } catch (SQLException se) {
            m_log.info("initial() database closing failure : url = " + m_url + ", "
                    + se.getClass().getSimpleName() + ", " + se.getMessage());
        }
        try {
            if (m_connection != null)
                m_connection.close();
        } catch (SQLException se) {
            m_log.info("initial() database closing failure : url = " + m_url + ", "
                    + se.getClass().getSimpleName() + ", " + se.getMessage());
        }
        throw e;
    }
}

From source file:com.developmentsprint.spring.breaker.hystrix.HystrixCircuitManager.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private HystrixFallback<?> determineFallback(CircuitBreakerAttribute attr) {
    Map<String, String> properties = attr.getProperties();
    String fallbackClassName = null;
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        if (entry.getKey().equals("fallbackClass")) {
            fallbackClassName = entry.getValue();
        }/*w ww .  j av a 2  s  .c  o  m*/
    }

    if (StringUtils.isBlank(fallbackClassName)) {
        return null;
    }

    Class<? extends HystrixFallback> fallbackClass;
    try {
        fallbackClass = (Class<? extends HystrixFallback>) Class.forName(fallbackClassName);
    } catch (ClassNotFoundException e) {
        throw new CircuitBreakerException(e.getMessage(), e);
    }

    try {
        fallbackClass.getDeclaredConstructor().setAccessible(true);
        return fallbackClass.getDeclaredConstructor().newInstance();
    } catch (Exception e) {
        throw new CircuitBreakerException(e.getMessage(), e);
    }
}