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:com.rolmex.android.nemalltone.fragment.PageFragment1.java

public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    gridView.setOnViewGroupItemClickListener(new OnViewGroupItemClickListener() {

        @Override/*from   ww w  . j a v  a 2 s. co  m*/
        public void ItemClickListener(ItemBean bean) {
            // TODO Auto-generated method stub
            itemDao.insertIfNot(bean);

            Class class1 = null;
            try {
                class1 = Class.forName("com.rolmex.android.nemalltone." + bean.item_class);
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Intent intent = new Intent(getActivity(), class1);
            startActivity(intent);
        }

    });
    List<ItemBean> list = new ArrayList<ItemBean>();

    for (int i = 0; i < 10; i++) {
        list.add(new ItemBean("??" + i, R.drawable.main_icon_dealer + i, "MainActivity"));
    }
    gridView.AddData(list);
}

From source file:org.seamless_ip.services.dao.EnumDaoImpl.java

@SuppressWarnings("unchecked")
public EnumTO findById(String dbClassName, Long id) {
    try {//w w w .  j a  va2  s . c om
        Class<?> dbClass = Class.forName(dbClassName);
        Object dbItem = getSessionFactory().getCurrentSession().get(dbClass, id);
        return createTO(dbItem);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:edu.stanford.junction.sample.sql.QueryHandler.java

@Override
public void onMessageReceived(MessageHeader header, JSONObject message) {

    //String query = q.getQueryText();
    String query = message.optString("query");

    query = query.toLowerCase();//  w  w w . j  a v a  2s . co m

    if (!query.contains("select"))
        return;
    if (query.contains("drop") || query.contains("delete"))
        return;
    System.out.println("Got query: " + query);

    Connection connection = null;
    try {
        // Load the JDBC driver
        String driverName = "com.mysql.jdbc.Driver"; // MySQL MM JDBC driver
        Class.forName(driverName);

        // Create a connection to the database
        //String serverName = "192.168.1.122";
        String serverName = "127.0.0.1";
        String mydatabase = "jinzora3";
        String url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
        String username = "jinzora";
        String password = "jinzora";
        connection = DriverManager.getConnection(url, username, password);
    } catch (ClassNotFoundException e) {
        // Could not find the database driver
        e.printStackTrace();
    } catch (SQLException e) {
        // Could not connect to the database
        e.printStackTrace();
    }

    try {
        Statement stmt = connection.createStatement();
        ResultSet rs = stmt.executeQuery(query);

        ResultSetMetaData rsMetaData = rs.getMetaData();
        int cols = rsMetaData.getColumnCount();

        while (rs.next()) {

            JSONObject row = new JSONObject();
            try {
                for (int i = 1; i <= cols; i++) { // stupid indexing
                    row.put(rsMetaData.getColumnName(i), rs.getObject(i));
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
            System.out.println("sending " + row);
            if (mActor != null) {
                //mActor.getJunction().sendMessageToTarget(header.getReplyTarget(),row);
                header.getReplyTarget().sendMessage(row);
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }

    System.out.println("closing stream.");
    //results.close();
}

From source file:org.seamless_ip.services.dao.EnumDaoImpl.java

@SuppressWarnings("unchecked")
public Collection<EnumTO> findAll(String dbClassName) {
    ArrayList<EnumTO> result = new ArrayList<EnumTO>();
    try {//w ww  .  jav a2 s.  c  o  m
        Class<?> dbClass = Class.forName(dbClassName);
        Collection<Object> dbItems = getSessionFactory().getCurrentSession().createCriteria(dbClass).list();
        for (Object dbItem : dbItems)
            result.add(createTO(dbItem));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    return result;
}

From source file:com.ailk.oci.ocnosql.tools.load.single.SingleColumnReducer.java

protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);

    sb = new StringBuilder();
    Date date = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm");
    curTime = formatter.format(date);//from  w  ww .  j ava2  s .c om

    //keyvalue?
    map = new TreeSet<KeyValue>(KeyValue.COMPARATOR);

    //
    record_separator = CommonConstants.RECORD_SEPARATOR;

    //???
    String familyStr = context.getConfiguration().get(CommonConstants.SINGLE_FAMILY);
    if (StringUtils.isEmpty(familyStr)) {
        String columns = context.getConfiguration().get(CommonConstants.COLUMNS);
        familyStr = columns.substring(0, columns.indexOf(":"));
    }
    family = Bytes.toBytes(familyStr);

    try {
        //
        initCompressInstance(context);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:io.dacopancm.oraclesp.MainApp.java

public void testConnect() {

    System.out.println("-------- Oracle JDBC Connection Testing ------");

    try {/*ww w.j av a  2 s.c o  m*/

        Class.forName("oracle.jdbc.driver.OracleDriver");

    } catch (ClassNotFoundException e) {

        System.out.println("Where is your Oracle JDBC Driver?");
        e.printStackTrace();
        return;

    }

    System.out.println("Oracle JDBC Driver Registered!");

    Connection connection = null;

    try {

        connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.2:1521:enki", "scott",
                "DACOPANdacopan1");

    } catch (SQLException e) {

        System.out.println("Connection Failed! Check output console");
        e.printStackTrace();
        return;

    }

    if (connection != null) {
        System.out.println("You made it, take control your database now!");
    } else {
        System.out.println("Failed to make connection!");
    }
}

From source file:mondrian.util.ServiceDiscovery.java

/**
 * Parses a list of classes that implement a service.
 *
 * @param clazz Class name (or list of class names)
 * @param cLoader Class loader/*from   w w w .j ava  2s.  c  o m*/
 * @param uniqueClasses Set of classes (output)
 */
protected void parseImplementor(String clazz, ClassLoader cLoader, Set<Class<T>> uniqueClasses) {
    // Split should leave me with a class name in the first string
    // which will nicely ignore comments in the line. I checked
    // and found that it also doesn't choke if:
    // a- There are no spaces on the line - you end up with one entry
    // b- A line begins with a whitespace character (the trim() fixes that)
    // c- Multiples of the same interface are filtered out
    assert clazz != null;

    String[] classList = clazz.trim().split("#");
    String theClass = classList[0].trim(); // maybe overkill, maybe not. :-D
    if (theClass.length() == 0) {
        // Ignore lines that are empty after removing comments & trailing
        // spaces.
        return;
    }
    try {
        // I want to look up the class but not cause the static
        // initializer to execute.
        Class interfaceImplementor = Class.forName(theClass, false, cLoader);
        if (theInterface.isAssignableFrom(interfaceImplementor)) {
            //noinspection unchecked
            uniqueClasses.add((Class<T>) interfaceImplementor);
        } else {
            logger.error("Class " + interfaceImplementor + " cannot be assigned to interface " + theInterface);
        }
    } catch (ClassNotFoundException ignored) {
        ignored.printStackTrace();
    } catch (LinkageError ignored) {
        // including ExceptionInInitializerError
        ignored.printStackTrace();
    }
}

From source file:jdbc.pool.LoadTest.java

/**
 * //from w  w  w  .  j av a 2  s .  c  om
 */
private void startLoadTest() {
    try {
        poolManager_.getConnection("TMP");
        TimeUnit.MINUTES.sleep(50);
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        poolManager_.destroy(true);
    }
    //        long lStartTime = System.currentTimeMillis();
    //        iThreadCounter_ = 0;
    //        while ((System.currentTimeMillis() - lStartTime) <(iTimeInMinutes_ * 60 * 60 * 1000)) {
    //            if (iThreadCounter_ < iThreads_) {
    //                Thread th = new Thread(new JDBCPoolT(iThreadCounter_));
    //                th.start();
    //                iThreadCounter_++;
    //            }
    //        }
}

From source file:com.acdd.homelauncher.MainActivity.java

String getVersionName() {
    try {/*from w  ww  .  j  a va2  s  .  c  o  m*/
        Class sdk = Class.forName("org.acdd.sdk.BuildConfig");
        Field mField = Reflect.getField(sdk, "VERSION_NAME");
        String verName = (String) mField.get(null);
        return verName;
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return "not found";
}

From source file:com.acdd.homelauncher.MainActivity.java

int getVersionCode() {
    try {//from  w ww  .  j a  v  a2 s . c om
        Class sdk = Class.forName("org.acdd.sdk.BuildConfig");
        Field mField = Reflect.getField(sdk, "VERSION_CODE");
        int verName = mField.getInt(null);
        return verName;
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return 1;
}