List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:gov.pnnl.goss.gridappsd.GridAppsDataSourcesComponentTests.java
@Test /**/*from ww w. j av a 2 s . co m*/ * Succeeds when the proper number of properties are set on the updated call, and datasourcebuilder.create is called, and the correct registered datasource name is added */ public void registryUpdatedWhen_dataSourcesStarted() { ArgumentCaptor<String> argCaptor = ArgumentCaptor.forClass(String.class); Properties datasourceProperties = new Properties(); GridAppsDataSourcesImpl dataSources = new GridAppsDataSourcesImpl(logger, datasourceBuilder, datasourceRegistry, datasourceProperties); Hashtable<String, String> props = new Hashtable<String, String>(); String datasourceName = "pnnl.goss.sql.datasource.gridappsd"; props.put("name", datasourceName); props.put(DataSourceBuilder.DATASOURCE_USER, "gridappsduser"); props.put(DataSourceBuilder.DATASOURCE_PASSWORD, "gridappsdpw"); props.put(DataSourceBuilder.DATASOURCE_URL, "mysql://lalala"); props.put("driver", "com.mysql.jdbc.Driver"); dataSources.updated(props); assertEquals(5, datasourceProperties.size()); dataSources.start(); //verify datasourceBuilder.create(datasourceName, datasourceProperties); try { Mockito.verify(datasourceBuilder).create(argCaptor.capture(), Mockito.any()); assertEquals(datasourceName, argCaptor.getValue()); } catch (ClassNotFoundException e) { e.printStackTrace(); assert (false); } catch (Exception e) { e.printStackTrace(); assert (false); } //verify registeredDatasources.add(datasourceName); List<String> registeredDatasources = dataSources.getRegisteredDatasources(); assertEquals(1, registeredDatasources.size()); }
From source file:gov.pnnl.goss.gridappsd.GridAppsDataSourcesComponentTests.java
@Test /**// w ww . java 2 s . co m * Succeeds when the registry is empty after the service has been stopped */ public void registryClearedWhen_dataSourcesStopped() { ArgumentCaptor<String> argCaptor = ArgumentCaptor.forClass(String.class); Properties datasourceProperties = new Properties(); GridAppsDataSourcesImpl dataSources = new GridAppsDataSourcesImpl(logger, datasourceBuilder, datasourceRegistry, datasourceProperties); Hashtable<String, String> props = new Hashtable<String, String>(); String datasourceName = "pnnl.goss.sql.datasource.gridappsd"; props.put("name", datasourceName); props.put(DataSourceBuilder.DATASOURCE_USER, "gridappsduser"); props.put(DataSourceBuilder.DATASOURCE_PASSWORD, "gridappsdpw"); props.put(DataSourceBuilder.DATASOURCE_URL, "mysql://lalala"); props.put("driver", "com.mysql.jdbc.Driver"); dataSources.updated(props); assertEquals(5, datasourceProperties.size()); dataSources.start(); //verify datasourceBuilder.create(datasourceName, datasourceProperties); try { Mockito.verify(datasourceBuilder).create(argCaptor.capture(), Mockito.any()); assertEquals(datasourceName, argCaptor.getValue()); } catch (ClassNotFoundException e) { e.printStackTrace(); assert (false); } catch (Exception e) { e.printStackTrace(); assert (false); } //verify registeredDatasources.add(datasourceName); List<String> registeredDatasources = dataSources.getRegisteredDatasources(); assertEquals(1, registeredDatasources.size()); dataSources.stop(); assertEquals(0, dataSources.getRegisteredDatasources().size()); }
From source file:gemlite.core.internal.view.func.ViewManagerFunc.java
/** * ReCreate view after deleted.// ww w . j a v a2s .co m * * @param paramsMap * @return */ @SuppressWarnings({ "unchecked", "rawtypes" }) private String createView(Map<String, Object> paramsMap) { String msg = getNodeInfo(); String clsName = (String) paramsMap.get("ClassName"); if (StringUtils.isEmpty(clsName)) { String result = msg + "Input param can't be null."; return result; } StringBuffer sb = new StringBuffer(); sb.append(msg + "\n"); GemliteViewContext ctx = GemliteViewContext.getInstance(); Class<ViewTool> cls = null; try { cls = (Class<ViewTool>) ViewManagerFunc.class.getClassLoader().loadClass(clsName); } catch (ClassNotFoundException e) { e.printStackTrace(); sb.append("Create view failed, class " + clsName + " not found in classloader."); return sb.toString(); } try { ctx.createView(cls); } catch (Exception e) { e.printStackTrace(); sb.append("Create view failed." + "\n"); sb.append(e.getMessage() + "\n"); return sb.toString(); } sb.append("Create view successfully."); return sb.toString(); }
From source file:com.umeng.common.ui.presenter.impl.UserSettingPresenter.java
private Class<?> getIntentClass() { Class<?> guideclass = null; if (Constants.VERSION == 2) { try {//from w w w . j a va 2s .co m guideclass = Class.forName("com.umeng.comm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (guideclass == null) { try { guideclass = Class.forName("com.umeng.commm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } else if (Constants.VERSION == 1) { try { guideclass = Class.forName("com.umeng.commm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (guideclass == null) { try { guideclass = Class.forName("com.umeng.comm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } else { try { guideclass = Class.forName("com.umeng.comm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (guideclass == null) { try { guideclass = Class.forName("com.umeng.commm.ui.activities.GuideActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } return guideclass; }
From source file:com.softberries.klerk.dao.DocumentDao.java
@Override public Document find(Long id) throws SQLException { Document d = null;//w w w .j a va2 s .c o m try { init(); ResultSetHandler<Document> h = new BeanHandler<Document>(Document.class); d = run.query(conn, SQL_FIND_DOCUMENT_BY_ID, h, id); //find items, creator, seller and buyer DocumentItemDao idao = new DocumentItemDao(this.filePath); CompanyDao cdao = new CompanyDao(this.filePath); PeopleDao pdao = new PeopleDao(this.filePath); d.setItems(idao.findAllByDocumentId(d.getId(), run, conn)); if (d.getDocumentType() == IDocumentType.INVOICE_PURCHASE) { d.setSeller(cdao.find(d.getSeller_id(), run, conn, st, generatedKeys)); } else { d.setBuyer(cdao.find(d.getBuyer_id(), run, conn, st, generatedKeys)); } d.setCreator(pdao.find(d.getCreator_id(), run, conn, st, generatedKeys)); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { close(conn, st, generatedKeys); } return d; }
From source file:com.softberries.klerk.dao.DocumentDao.java
public List<Document> findAllByType(final int DOC_TYPE) throws SQLException { List<Document> documents = new ArrayList<Document>(); try {/*from w w w.j av a 2 s . c om*/ init(); ResultSetHandler<List<Document>> h = new BeanListHandler<Document>(Document.class); documents = run.query(conn, SQL_FIND_DOCUMENT_BY_TYPE, h, DOC_TYPE); //find items DocumentItemDao idao = new DocumentItemDao(this.filePath); CompanyDao cdao = new CompanyDao(this.filePath); PeopleDao pdao = new PeopleDao(this.filePath); for (Document d : documents) { d.setItems(idao.findAllByDocumentId(d.getId(), run, conn)); if (d.getDocumentType() == IDocumentType.INVOICE_PURCHASE) { d.setSeller(cdao.find(d.getSeller_id(), run, conn, st, generatedKeys)); } else { d.setBuyer(cdao.find(d.getBuyer_id(), run, conn, st, generatedKeys)); } d.setCreator(pdao.find(d.getCreator_id(), run, conn, st, generatedKeys)); } } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { close(conn, st, generatedKeys); } return documents; }
From source file:com.remobile.file.AssetFilesystem.java
private void lazyInitCaches() { synchronized (listCacheLock) { if (listCache == null) { ObjectInputStream ois = null; try { ois = new ObjectInputStream(assetManager.open("cdvasset.manifest")); listCache = (Map<String, String[]>) ois.readObject(); lengthCache = (Map<String, Long>) ois.readObject(); listCacheFromFile = true; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { // Asset manifest won't exist if the gradle hook isn't set up correctly. } finally { if (ois != null) { try { ois.close();/*w w w . ja v a2 s . c om*/ } catch (IOException e) { } } } if (listCache == null) { Log.w("AssetFilesystem", "Asset manifest not found. Recursive copies and directory listing will be slow."); listCache = new HashMap<String, String[]>(); } } } }
From source file:com.softberries.klerk.dao.DocumentDao.java
@Override public List<Document> findAll() throws SQLException { List<Document> documents = new ArrayList<Document>(); try {//ww w . ja v a2s. c om init(); ResultSetHandler<List<Document>> h = new BeanListHandler<Document>(Document.class); documents = run.query(conn, SQL_FIND_DOCUMENT_ALL, h); //find items DocumentItemDao idao = new DocumentItemDao(this.filePath); CompanyDao cdao = new CompanyDao(this.filePath); PeopleDao pdao = new PeopleDao(this.filePath); for (Document d : documents) { d.setItems(idao.findAllByDocumentId(d.getId(), run, conn)); if (d.getDocumentType() == IDocumentType.INVOICE_PURCHASE) { d.setSeller(cdao.find(d.getSeller_id(), run, conn, st, generatedKeys)); } else { d.setBuyer(cdao.find(d.getBuyer_id(), run, conn, st, generatedKeys)); } d.setCreator(pdao.find(d.getCreator_id(), run, conn, st, generatedKeys)); } } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { close(conn, st, generatedKeys); } return documents; }
From source file:com.mvdb.etl.dao.impl.JdbcGenericDAO.java
@Override public Metadata getMetadata(String objectName, File snapshotDirectory) { try {/* ww w . j a v a 2 s.com*/ return readMetadata(objectName, snapshotDirectory); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:org.seamless_ip.services.dao.IndicatorValueDaoImpl.java
@SuppressWarnings("unchecked") public Collection<IIndicatorValueTO> findAllByIndicatorId(Long experimentId, Long indicatorId) { ArrayList<IIndicatorValueTO> result = new ArrayList<IIndicatorValueTO>(); Query q = query("from IIndicatorValue v where v.Experiment.id = :expId and v.Indicator.id = :indId") .setParameter("expId", experimentId).setParameter("indId", indicatorId); try {// w ww.j av a 2 s .c o m List<IIndicatorValue> dbItems = q.list(); if (dbItems != null) for (IIndicatorValue dbItem : dbItems) result.add(createTO(dbItem)); } catch (ClassNotFoundException e) { e.printStackTrace(); } return result; }