Example usage for java.lang ClassNotFoundException printStackTrace

List of usage examples for java.lang ClassNotFoundException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:se.sics.kompics.p2p.monitor.cyclon.server.CyclonMonitorServer.java

public CyclonMonitorServer(CyclonMonitorServerInit init) {
    this.view = new HashMap<OverlayAddress, OverlayViewEntry>();
    this.alivePeers = new TreeMap<OverlayAddress, CyclonNeighbors>();
    this.deadPeers = new TreeMap<OverlayAddress, CyclonNeighbors>();
    this.outstandingTimeouts = new HashSet<UUID>();

    subscribe(handleWebRequest, web);/*from   w  w  w  .  ja v a 2s  .co m*/
    subscribe(handlePeerNotification, network);
    subscribe(handleViewEvictPeer, timer);

    // INIT
    evictAfter = init.getConfiguration().getViewEvictAfter();

    logger.debug("INIT");

    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (ClassNotFoundException e1) {
        e1.printStackTrace();
    } catch (InstantiationException e1) {
        e1.printStackTrace();
    } catch (IllegalAccessException e1) {
        e1.printStackTrace();
    } catch (UnsupportedLookAndFeelException e1) {
        e1.printStackTrace();
    }
}

From source file:cn.quickj.AbstractApplication.java

/**
 * ?applicationFilter/* ww  w  .j  av a2  s.  co  m*/
 */
private void parserFilter() {
    // FIXME ?Filter
    Filter filter = getClass().getAnnotation(Filter.class);
    String[] filterNames;
    if (filter != null && filter.name() != null) {
        filterNames = filter.name().split(";");
        for (String filterName : filterNames) {
            String[] s = filterName.split(":");
            Class<?> c = null;
            try {
                c = Class.forName(Setting.packageRoot + ".filter." + s[0]);
            } catch (ClassNotFoundException e) {
                try {
                    c = Class.forName("cn.quickj.filter." + s[0]);
                } catch (ClassNotFoundException e1) {
                    e1.printStackTrace();
                }
            }
            if (c == null)
                continue;
            filterClasses.add(c);
            if (s.length == 2)
                filterParams.add(QuickUtils.parserFilterParams(s[1]));
            else
                filterParams.add(null);
        }
    }
}

From source file:beerman.scheduler.BeermanScheduler.java

@Override
public Endpoint getNextEndpoint(MessageContext synapseMessageContext, AlgorithmContext algorithmContext) {
    String destString = synapseMessageContext.getTo().toString();
    String[] components = destString.split("\\?");
    String user = components[components.length - 1];

    // this will load the MySQL driver, each DB has its own driver
    try {/*www.j  a  v  a 2 s  .  com*/
        Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }

    try {
        connect = (Connection) DriverManager
                .getConnection("jdbc:mysql://54.84.225.2/SD_Proj_DB?" + "user=SD_Proj&password=PasswordSD");
        return this.getEndpointFromDB(connect, user);
    } catch (SQLException e) {
        log.error("Server 1 could not be accessed! " + e.getMessage());
        // First server is down! Try the second one!!!!!!!
        try {
            connect = (Connection) DriverManager
                    .getConnection("jdbc:mysql://54.85.111.6/SD_Proj_DB?" + "user=SD_Proj&password=PasswordSD");
            return this.getEndpointFromDB(connect, user);
        } catch (SQLException e1) {
            // Both of them are down. Just return the first one
            log.error("Both servers cannot be accessed! " + e1.getMessage());
        }
    }

    int userNum = Integer.parseInt(user);
    int index = userNum % NUMBER_SERVERS;
    return (Endpoint) this.endpoints.get(index);
}

From source file:me.piebridge.android.preference.PreferenceFragment.java

@Override
public void onStart() {
    super.onStart();
    // FIXME: mPreferenceManager.setOnPreferenceTreeClickListener(this);
    try {// w  ww .j a va 2  s  .com
        Class<?> clazz = Class.forName("android.preference.PreferenceManager$OnPreferenceTreeClickListener");
        Object proxy = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz },
                new InvocationHandler() {
                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        if (method.getName().equals("onPreferenceTreeClick")) {
                            return onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]);
                        }
                        return null;
                    }
                });
        callVoidMethod(mPreferenceManager, "setOnPreferenceTreeClickListener", new Class[] { clazz },
                new Object[] { proxy });
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:EnrollFingerprint.Enroll.java

public void testOracle() {
    Connection conn = null;//from  w w  w  . ja  v a2s . c om
    try {
        //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
        Class.forName("oracle.jdbc.OracleDriver");
        conn = DriverManager.getConnection(connectionString);
        if (conn != null) {
            System.out.println("Conexion con Oracle exitosa!.");
        } else {
            System.out.println("Error conectandoce a Oracle Local");
        }
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    } catch (SQLException ex) {
        ex.printStackTrace();
    } finally {
        try {
            if (conn != null && !conn.isClosed()) {
                conn.close();
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }

}

From source file:com.kylinolap.rest.service.QueryService.java

/**
 * @param preparedState/*from   w  ww . jav a2s.co m*/
 * @param param
 * @throws SQLException
 */
private void setParam(PreparedStatement preparedState, int index, StateParam param) throws SQLException {
    boolean isNull = (null == param.getValue());

    Class<?> clazz = Object.class;
    try {
        clazz = Class.forName(param.getClassName());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }

    Rep rep = Rep.of(clazz);

    switch (rep) {
    case PRIMITIVE_CHAR:
    case CHARACTER:
    case STRING:
        preparedState.setString(index, isNull ? null : String.valueOf(param.getValue()));
        break;
    case PRIMITIVE_INT:
    case INTEGER:
        preparedState.setInt(index, isNull ? null : Integer.valueOf(param.getValue()));
        break;
    case PRIMITIVE_SHORT:
    case SHORT:
        preparedState.setShort(index, isNull ? null : Short.valueOf(param.getValue()));
        break;
    case PRIMITIVE_LONG:
    case LONG:
        preparedState.setLong(index, isNull ? null : Long.valueOf(param.getValue()));
        break;
    case PRIMITIVE_FLOAT:
    case FLOAT:
        preparedState.setFloat(index, isNull ? null : Float.valueOf(param.getValue()));
        break;
    case PRIMITIVE_DOUBLE:
    case DOUBLE:
        preparedState.setDouble(index, isNull ? null : Double.valueOf(param.getValue()));
        break;
    case PRIMITIVE_BOOLEAN:
    case BOOLEAN:
        preparedState.setBoolean(index, isNull ? null : Boolean.parseBoolean(param.getValue()));
        break;
    case PRIMITIVE_BYTE:
    case BYTE:
        preparedState.setByte(index, isNull ? null : Byte.valueOf(param.getValue()));
        break;
    case JAVA_UTIL_DATE:
    case JAVA_SQL_DATE:
        preparedState.setDate(index, isNull ? null : java.sql.Date.valueOf(param.getValue()));
        break;
    case JAVA_SQL_TIME:
        preparedState.setTime(index, isNull ? null : Time.valueOf(param.getValue()));
        break;
    case JAVA_SQL_TIMESTAMP:
        preparedState.setTimestamp(index, isNull ? null : Timestamp.valueOf(param.getValue()));
        break;
    default:
        preparedState.setObject(index, isNull ? null : param.getValue());
    }
}

From source file:com.apatar.webdav.WebDavNode.java

@Override
public void createDatabaseParam(Wizard wizard) {
    JDialog wd = wizard.getDialog();

    wd.setTitle(title + " Property");

    try {//from  w  ww  .j a  va 2  s.com
        WizardPanelDescriptor descriptor1 = new DBConnectionDescriptor(this,
                new JPropertySheetPage(wizard.getDialog()), WebDavFolderTreeDescriptor.IDENTIFIER,
                ApplicationData.classForName("com.apatar.webdav.WebDavConnection"), "db_connector", "webdav");
        wizard.registerWizardPanel(DBConnectionDescriptor.IDENTIFIER, descriptor1);

        WizardPanelDescriptor descriptor2 = new WebDavFolderTreeDescriptor(this,
                DBConnectionDescriptor.IDENTIFIER, WebDavModeDescriptor.IDENTIFIER);
        wizard.registerWizardPanel(WebDavFolderTreeDescriptor.IDENTIFIER, descriptor2);

        WizardPanelDescriptor descriptor3 = new WebDavModeDescriptor(this,
                WebDavFolderTreeDescriptor.IDENTIFIER, WizardPanelDescriptor.FINISH);
        wizard.registerWizardPanel(WebDavModeDescriptor.IDENTIFIER, descriptor3);

        wizard.setKeyForReferringToDescription("help.connector.webdav");
        wizard.setCurrentPanel(DBConnectionDescriptor.IDENTIFIER, Wizard.NEXT_BUTTON_ACTION_COMMAND);

        wizard.showModalDialog();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.sf.infrared.collector.impl.persistence.ApplicationStatisticsDaoImpl.java

AggregateOperationTree fetchAggregateOperationTree(Collection appNames, Collection instanceIds, Date fromDate,
        Date toDate) {//from ww w . ja va2 s  . c o m
    Object[] stringAndArray = getWhereStringAndArgArray(appNames, instanceIds, fromDate, toDate);
    String whereClause = (String) stringAndArray[0];
    Object[] argArray = (Object[]) stringAndArray[1];

    // making use of a spring ResultSetExtractor implementation to get the merged tree.
    AggregateOperationTree aggOpTree = (AggregateOperationTree) getJdbcTemplate()
            .query(SQL_FETCH_TREE + whereClause, argArray, new ResultSetExtractor() {
                public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
                    AggregateOperationTree newTree = null;
                    AggregateOperationTree aggOpTree = new AggregateOperationTree();
                    while (rs.next()) {
                        try {
                            InputStream is = rs.getBinaryStream("TREE");
                            ObjectInputStream ois = new ObjectInputStream(is);
                            Tree tree = (Tree) ois.readObject();
                            newTree = new AggregateOperationTree();
                            newTree.setAggregateTree(tree);
                            aggOpTree.merge(newTree);
                        } catch (IOException e) {
                            e.printStackTrace();
                        } catch (ClassNotFoundException ex) {
                            ex.printStackTrace();
                        }
                    }
                    return aggOpTree;
                }
            });

    return aggOpTree;
}

From source file:org.accada.reader.hal.impl.sim.SimulatorController.java

public SimulatorController(String halName) {
    this.halName = halName;
    this.initialize();

    log.debug("Simulator: " + simType);
    reader = new HashMap();

    for (int i = 0; i < nOfReadPoints; i++) {
        reader.put(readPointNames[i], new HashSet());
    }/*from   w  w  w.  ja  v a2 s.  co  m*/

    try {
        //Dynamic class loading
        //1.) The full package path 
        Class clazz = Class.forName(simType);
        //2.) State the types of the constructors arguments. here: only one argument, of type String
        java.lang.reflect.Constructor co = clazz.getConstructor(new Class[] {});
        //3.) Create new instance with the argument's values
        simulator = (SimulatorEngine) co.newInstance(null);
        simulator.initialize(this);
    } catch (ClassNotFoundException cnfe) {
        cnfe.printStackTrace();
        System.exit(1);
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
}

From source file:org.apache.hadoop.hive.ql.metadata.BIStore.java

public Connection openConnect() {
    try {//from   w  w  w.  j a va2 s. c  o  m
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException e) {
        LOG.error(" get org.postgresql.Driver failed ");
        e.printStackTrace();
    }
    Connection conn = null;
    try {
        LOG.debug(" Connecting: " + url);
        DriverManager.setLoginTimeout(waittime);
        conn = DriverManager.getConnection(url, this.prop);
        try {
            String processName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName();
            String processID = processName.substring(0, processName.indexOf('@'));
            String appinfo = "openConnect_" + processID + "_" + SessionState.get().getSessionName();
            conn.setClientInfo("ApplicationName", appinfo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        LOG.debug(" get Connection ok: " + url);
    } catch (SQLException e) {
        LOG.error(" get Connection failed: " + url);
        e.printStackTrace();
    }
    return conn;
}