List of usage examples for java.lang ClassNotFoundException getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.cloudifysource.restDoclet.generation.Generator.java
private <T> T getExampleGeneratorClass(final Class<T> expectedInterface, final String exampleGeneratorName, final String exampleType) { if (StringUtils.isBlank(exampleGeneratorName)) { logger.log(Level.INFO, "No custom example generator given, using a default " + exampleType + " example generator instead."); return null; }/*from ww w . jav a2 s. com*/ Class<?> reqExGenClass; try { reqExGenClass = Class.forName(exampleGeneratorName); } catch (ClassNotFoundException e) { logger.log(Level.WARNING, "Cought ClassNotFoundException when tried to load the " + exampleType + " example generator class - " + exampleGeneratorName + ". Using a default generator instead."); return null; } if (!expectedInterface.isAssignableFrom(reqExGenClass)) { logger.log(Level.WARNING, "The given " + exampleType + " example generator class [" + exampleGeneratorName + "] does not implement " + expectedInterface.getName() + ". Using a default generator instead."); return null; } try { return expectedInterface.cast(reqExGenClass.newInstance()); } catch (Exception e) { logger.log(Level.WARNING, "Cought exception - " + e.getClass().getName() + " when tried to instantiate the " + exampleType + " example generator class [ " + exampleGeneratorName + "]. Using a default generator instead."); return null; } }
From source file:org.protempa.backend.dsb.relationaldb.AbstractSQLGenerator.java
@Override public final boolean loadDriverIfNeeded() { String className = getDriverClassNameToLoad(); if (className == null) { return true; }//from www. ja v a 2 s . c om try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { Logger logger = SQLGenUtil.logger(); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "{0} when trying to load {1}.", new Object[] { ex.getClass().getName(), className }); } return false; } }
From source file:org.saiku.adhoc.utils.TemplateUtils.java
/** * Finds the class for a given aggreagation function name * // w w w. j a va 2 s.c o m * @param str * @return * @throws ReportException */ public static Class strToAggfunctionClass(String str) throws ReportException { try { if (str.equals("NONE")) { return null; } else if (str.equals("SUM")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.ItemSumFunction"); } else if (str.equals("AVERAGE")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.ItemAvgFunction"); } else if (str.equals("COUNT")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.ItemCountFunction"); } else if (str.equals("COUNT_DISTINCT")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.CountDistinctFunction"); } else if (str.equals("MINIMUM")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.ItemMinFunction"); } else if (str.equals("MAXIMUM")) { return Class.forName("org.pentaho.reporting.engine.classic.core.function.ItemMaxFunction"); } } catch (ClassNotFoundException e) { final String message = e.getCause() != null ? e.getCause().getClass().getName() + " - " + e.getCause().getMessage() : e.getClass().getName() + " - " + e.getMessage(); log.error(message, e); throw new ReportException("Aggregation Class not found", e); } return null; }
From source file:shnakkydoodle.measuring.provider.MetricsProviderSQLServer.java
/** * Check if LoggingData table exists// w w w . j a v a 2 s.co m * * @return */ private boolean CheckIfDatabaseTablesExists() { Connection conn = null; boolean flag = false; try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); conn = DriverManager.getConnection(this.host + ";user=" + this.username + ";password=" + this.password); DatabaseMetaData meta = conn.getMetaData(); ResultSet res = meta.getTables(null, null, null, new String[] { "TABLE" }); while (res.next()) { if (res.getString("TABLE_TYPE").equalsIgnoreCase("TABLE")) { if (res.getString("TABLE_NAME").equalsIgnoreCase("MetricData")) { flag = true; break; } } } res.close(); conn.close(); } catch (ClassNotFoundException e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(); } catch (SQLException e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(); } return flag; }