List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:corner.orm.tapestry.component.gain.GainPoint.java
/** * ?entity//from www . j a v a 2s. c o m */ private <T> void entityWorkshop() { Object entity = null; int Size = this.getForegroundLength(); Class entityClass = null; try { entityClass = Class.forName(getEntityClass()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } neatenPersistentEntity(); //?? Object temp = null; //?? Iterator FEList = null; String epname = null; for (int i = 0; i < Size; i++) { if (i < this.getPersistentSize()) { entity = this.getEntitys().get(i); } else { try { entity = entityClass.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } FEList = this.getForegroundEntitys().iterator(); for (int j = 0; j < this.getForegroundEntitys().size(); j++) { List foregroundEntity = (List) FEList.next(); try { temp = foregroundEntity.get(i); if (temp != null && !temp.equals("")) { epname = this.getEntityPropertys().get(j); if (getPagePersistentId().equals(epname)) { //??id????id epname = getPersistentId(); } PropertyUtils.setProperty(entity, epname, temp); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } this.getSaveOrUpdateEntitys().add(entity); } // delNullEntity(); }
From source file:org.apache.catalina.startup.TldConfig.java
private void processCache(File tldCache) throws IOException { // read the cache and return; try {//from w w w. j a va 2s .c om FileInputStream in = new FileInputStream(tldCache); ObjectInputStream ois = new ObjectInputStream(in); String list[] = (String[]) ois.readObject(); if (log.isDebugEnabled()) log.debug("Reusing tldCache " + tldCache + " " + list.length); for (int i = 0; list != null && i < list.length; i++) { context.addApplicationListener(list[i]); } ois.close(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } }
From source file:net.cloudpath.xpressconnect.screens.GetCredentials.java
public WifiConfigurationProxy getExistingConfig(int paramInt) { List localList = ((WifiManager) getSystemService("wifi")).getConfiguredNetworks(); for (int i = 0; i < localList.size(); i++) if (((WifiConfiguration) localList.get(i)).networkId == paramInt) try { WifiConfigurationProxy localWifiConfigurationProxy = new WifiConfigurationProxy( (WifiConfiguration) localList.get(i), this.mLogger); return localWifiConfigurationProxy; } catch (IllegalArgumentException localIllegalArgumentException) { Util.log(this.mLogger, "IllegalArgumentException in getExistingConfig()!"); localIllegalArgumentException.printStackTrace(); return null; } catch (NoSuchFieldException localNoSuchFieldException) { Util.log(this.mLogger, "NoSuchFieldException in getExistingConfig()!"); localNoSuchFieldException.printStackTrace(); return null; } catch (ClassNotFoundException localClassNotFoundException) { Util.log(this.mLogger, "ClassNotFoundException in getExistingConfig()!"); localClassNotFoundException.printStackTrace(); return null; } catch (IllegalAccessException localIllegalAccessException) { Util.log(this.mLogger, "IllegalAccessException in getExistingConfig()!"); localIllegalAccessException.printStackTrace(); return null; }/*w ww.j a v a 2 s. com*/ return null; }
From source file:org.apache.wiki.auth.AuthenticationManager.java
/** * Creates an AuthenticationManager instance for the given WikiEngine and * the specified set of properties. All initialization for the modules is * done here./*from ww w. j av a2 s. com*/ * @param engine the wiki engine * @param props the properties used to initialize the wiki engine * @throws WikiException if the AuthenticationManager cannot be initialized */ @SuppressWarnings("unchecked") public void initialize(WikiEngine engine, Properties props) throws WikiException { m_engine = engine; m_storeIPAddress = TextUtil.getBooleanProperty(props, PROP_STOREIPADDRESS, m_storeIPAddress); // Should we allow cookies for assertions? (default: yes) m_allowsCookieAssertions = TextUtil.getBooleanProperty(props, PROP_ALLOW_COOKIE_ASSERTIONS, true); // Should we allow cookies for authentication? (default: no) m_allowsCookieAuthentication = TextUtil.getBooleanProperty(props, PROP_ALLOW_COOKIE_AUTH, false); // Should we throttle logins? (default: yes) m_throttleLogins = TextUtil.getBooleanProperty(props, PROP_LOGIN_THROTTLING, true); // Look up the LoginModule class String loginModuleClassName = TextUtil.getStringProperty(props, PROP_LOGIN_MODULE, DEFAULT_LOGIN_MODULE); try { m_loginModuleClass = (Class<? extends LoginModule>) Class.forName(loginModuleClassName); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new WikiException("Could not instantiate LoginModule class.", e); } // Initialize the LoginModule options initLoginModuleOptions(props); }
From source file:migration.ProjektMigration.java
/** * Inits the driver legacy db.//from ww w.j av a 2 s .c om */ private void initDriverLegacyDb() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch (final ClassNotFoundException e) { e.printStackTrace(); // To change body of catch statement use File | // Settings | File Templates. } }
From source file:org.apache.hadoop.raid.TestBlockCopier.java
public void setup(int numDataNodes, int timeBeforeHar) throws IOException, ClassNotFoundException { if (System.getProperty("hadoop.log.dir") == null) { String base = new File(".").getAbsolutePath(); System.setProperty("hadoop.log.dir", new Path(base).toString() + "/logs"); }//ww w.j av a2 s . c om new File(TEST_DIR).mkdirs(); // Make sure data directory exists conf = new Configuration(); conf.set("raid.config.file", CONFIG_FILE); conf.setBoolean("raid.config.reload", true); conf.setLong("raid.config.reload.interval", RELOAD_INTERVAL); conf.setBoolean("dfs.use.inline.checksum", false); // scan all policies once every 5 second conf.setLong("raid.policy.rescan.interval", 5000); conf.set("mapred.raid.http.address", "localhost:0"); // do not use map-reduce cluster for Raiding conf.set("raid.classname", "org.apache.hadoop.raid.LocalRaidNode"); conf.set("raid.server.address", "localhost:" + MiniDFSCluster.getFreePort()); Utils.loadTestCodecs(conf, STRIPE_LENGTH, 1, 3, "/raid", "/raidrs"); conf.setBoolean("dfs.permissions", false); // Prevent the namenode from replicating files conf.setInt("dfs.replication.interval", Integer.MAX_VALUE); conf.setClass("dfs.block.replicator.classname", BlockPlacementPolicyFakeData.class, BlockPlacementPolicy.class); // Set the class which is used for the copying operation //conf.setClass("raid.blockcopier.class", c, BlockCopyHelper.class); // Set up the mini-cluster dfs = new MiniDFSCluster(conf, numDataNodes, true, null, false); dfs.waitActive(); fileSys = (DistributedFileSystem) dfs.getFileSystem(); namenode = dfs.getNameNode(); String namenodeRoot = fileSys.getUri().toString(); FileSystem.setDefaultUri(conf, namenodeRoot); mr = new MiniMRCluster(4, namenodeRoot, 3); jobTrackerName = "localhost:" + mr.getJobTrackerPort(); hftp = "hftp://localhost.localdomain:" + dfs.getNameNodePort(); //FileSystem.setDefaultUri(conf, namenodeRoot); conf.set("mapred.job.tracker", jobTrackerName); FileWriter fileWriter = new FileWriter(CONFIG_FILE); fileWriter.write("<?xml version=\"1.0\"?>\n"); String str = "<configuration> " + "<policy name = \"RaidTest1\"> " + "<srcPath prefix=\"/user/hadoop/raidtest\"/> " + "<codecId>xor</codecId> " + "<property> " + "<name>targetReplication</name> " + "<value>1</value> " + "<description>after RAIDing, decrease the replication factor of a file to this value." + "</description> " + "</property> " + "<property> " + "<name>metaReplication</name> " + "<value>1</value> " + "<description> replication factor of parity file" + "</description> " + "</property> " + "<property> " + "<name>modTimePeriod</name> " + "<value>2000</value> " + "<description> time (milliseconds) after a file is modified to make it " + "a candidate for RAIDing " + "</description> " + "</property> "; if (timeBeforeHar >= 0) { str += "<property> " + "<name>time_before_har</name> " + "<value>" + timeBeforeHar + "</value> " + "<description> amount of time waited before har'ing parity files" + "</description> " + "</property> "; } str += "</policy>" + "</configuration>"; fileWriter.write(str); fileWriter.close(); // Set up raid node if (raidnode == null) { Configuration localConf = new Configuration(conf); localConf.setInt("raid.blockfix.interval", 1000); localConf.set("raid.blockfix.classname", "org.apache.hadoop.raid.DistBlockIntegrityMonitor"); localConf.setLong("raid.blockfix.filespertask", 2L); try { raidnode = RaidNode.createRaidNode(null, localConf); } catch (ClassNotFoundException ex) { ex.printStackTrace(); throw ex; } } // Set up excludes file excludeFile = new Path(TEST_DIR, "exclude"); conf.set("dfs.hosts.exclude", excludeFile.toUri().getPath()); conf.setInt("heartbeat.recheck.interval", 2000); conf.setInt("dfs.heartbeat.interval", 1); conf.setInt("dfs.replication.pending.timeout.sec", 4); writeExcludesFileAndRefresh(null); }
From source file:com.neighbor.ex.tong.ui.activity.MainActivity2Activity.java
private void bindService() { Intent intent = null;// w ww. java 2 s .co m try { intent = new Intent(getApplication().getApplicationContext(), Class.forName(LppService.class.getName())); intent.setPackage("com.neighbor.ex.tong"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (intent != null) { getApplicationContext().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); } }
From source file:assignment3.Populate.java
CreateBusiness() { try {// ww w . jav a 2 s . c om Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { System.out.println("JDBC Driver Missing"); e.printStackTrace(); return; } System.out.println("Oracle JDBC Driver Connected"); Connection conn = null; PreparedStatement ps = null; PreparedStatement psbusinesscat = null; PreparedStatement pscate = null; try { conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "MAYUR", "123456"); JSONParser parser = new JSONParser(); BufferedReader br = new BufferedReader(new FileReader( "C:\\Users\\mayur\\Downloads\\YelpDataset\\YelpDataset-CptS451\\yelp_business.json")); // BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\mayur\\Downloads\\YelpDataset\\YelpDataset-CptS451\\smallbusiness.json")); int batch = 200; int count = 0; String sCurrentLine = ""; String temp = ""; ArrayList<String> cat = new ArrayList<String>(); cat.add("Active Life"); cat.add("Arts & Entertainment"); cat.add("Automotive"); cat.add("Car Rental"); cat.add("Cafes"); cat.add("Beauty & Spas"); cat.add("Convenience Stores"); cat.add("Dentists"); cat.add("Doctors"); cat.add("Drugstores"); cat.add("Department Stores"); cat.add("Education"); cat.add("Event Planning & Services"); cat.add("Flower & Gifts"); cat.add("Food"); cat.add("Health & Medical"); cat.add("Home Services"); cat.add("Home & Gardens"); cat.add("Hospitals"); cat.add("Hotels & Travel"); cat.add("Hardware Stores"); cat.add("Grocery"); cat.add("Medical Centers"); cat.add("Nurseries & Gardening"); cat.add("Nightlife"); cat.add("Shopping"); cat.add("Restaurants"); cat.add("Transportation"); while ((sCurrentLine = br.readLine()) != null) { conn.setAutoCommit(false); Object obj = parser.parse(sCurrentLine); JSONObject t = (JSONObject) obj; String business_id = t.get("business_id").toString(); String city = t.get("city").toString(); String state = t.get("state").toString(); Long review_count = (Long) t.get("review_count"); Double stars = (Double) t.get("stars"); Double latitude = (Double) t.get("latitude"); Double longitude = (Double) t.get("longitude"); String business_name = t.get("name").toString(); String type = t.get("type").toString(); ps = conn.prepareStatement("insert into business values (?, ?, ?,?,?,?, ?, ?,?)"); ps.setString(1, business_id); ps.setString(2, city); ps.setString(3, state); ps.setLong(4, review_count); ps.setDouble(5, stars); ps.setDouble(6, latitude); ps.setDouble(7, longitude); ps.setString(8, business_name); ps.setString(9, type); ps.executeUpdate(); ps.close(); conn.commit(); psbusinesscat = conn.prepareStatement("insert into categories values (?,?,?)"); JSONArray categories = (JSONArray) (t).get("categories"); int numfriends = 0; if (categories.size() > 0) { ArrayList<String> categories_list = new ArrayList<String>(); ArrayList<String> subcategories_list = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>(); // Retrive categories from json and seperate it as category and subcategory for (int i = 0; i < categories.size(); i++) { String tempCat = categories.get(i).toString(); if (cat.contains(tempCat)) categories_list.add(tempCat); else subcategories_list.add(tempCat); } psbusinesscat.setString(1, business_id); for (int i = 0; i < categories_list.size(); i++) { System.out.println(categories_list.get(i) + " "); psbusinesscat.setString(2, categories_list.get(i)); if (subcategories_list.size() > 0) { // set category for business table for (int j = 0; j < subcategories_list.size(); j++) { System.out.println("-" + subcategories_list.get(j)); psbusinesscat.setString(3, subcategories_list.get(j)); psbusinesscat.executeUpdate(); list.add(categories_list.get(i) + "~" + subcategories_list.get(j)); //insert into business categories list } } else { psbusinesscat.setString(3, ""); psbusinesscat.executeUpdate(); System.out.println(""); } } psbusinesscat.close(); conn.commit(); List<String> deDupStringList = new ArrayList<>(new HashSet<>(list)); pscate = conn.prepareStatement("insert into categoryclass values (?,?)"); for (int i = 0; i < deDupStringList.size(); i++) { pscate.setString(1, deDupStringList.get(i).substring(0, deDupStringList.get(i).indexOf("~"))); System.out.println(deDupStringList.get(i).indexOf("~")); pscate.setString(2, deDupStringList.get(i).substring(deDupStringList.get(i).indexOf("~") + 1)); pscate.executeUpdate(); } pscate.close(); } conn.commit(); count++; System.out.println("Record Number :" + count); if (count % 50 == 0) { //reload driver conn.close(); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "MAYUR", "123456"); } } System.out.println("Last record inserted is " + count); conn.commit(); ps.close(); conn.close(); } catch (Exception e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } finally { try { ps.close(); pscate.close(); psbusinesscat.close(); conn.close(); } catch (Exception e) { } } }
From source file:org.apache.ctakes.ytex.kernel.dao.ConceptDaoImpl.java
private ConceptGraph readConceptGraph(String name) { ObjectInputStream is = null;/*from w w w. j av a 2s . c o m*/ try { // try loading from classpath InputStream resIs = this.getClass().getClassLoader() .getResourceAsStream(CONCEPT_GRAPH_PATH + name + ".gz"); if (resIs == null) { String cdir = this.getDefaultConceptGraphDir(); if (cdir == null) { throw new IllegalArgumentException( "could not determine default concept graph directory; please set property org.apache.ctakes.ytex.conceptGraphDir"); } File f = new File(cdir + "/" + name + ".gz"); log.info( "could not load conceptGraph from classpath, attempt to load from: " + f.getAbsolutePath()); if (f.exists()) { resIs = new FileInputStream(f); } else { log.info(f.getAbsolutePath() + " not found, cannot load concept graph"); } } else { log.info("loading concept graph from " + this.getClass().getClassLoader().getResource(CONCEPT_GRAPH_PATH + name + ".gz")); } if (resIs != null) { is = new ObjectInputStream(new BufferedInputStream(new GZIPInputStream(resIs))); return (ConceptGraph) is.readObject(); } else { log.info("could not load conceptGraph: " + name); return null; } } catch (IOException ioe) { throw new RuntimeException(ioe); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { if (is != null) try { is.close(); } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.neighbor.ex.tong.ui.activity.MainActivity2Activity.java
private void startService() { String canonicalName = LppService.class.getCanonicalName(); boolean isService = AppUtil.checkServieRunning(getApplicationContext(), canonicalName); if (isService == false) { Intent intent = null;//from w w w.ja v a 2 s .c o m try { intent = new Intent(getApplicationContext(), Class.forName(LppService.class.getName())); intent.setPackage("com.neighbor.ex.tong"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (intent != null) { // getApplicationContext().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); startService(intent); } } }