List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:common.DB.java
public static Connection getConnection() { try {//from w w w . j a va2s.com if (connection == null) { Properties prop = new Properties(); InputStream inputStream = DB.class.getClassLoader().getResourceAsStream("/db.properties"); System.out.println(inputStream); prop.load(inputStream); String driver = prop.getProperty("driver"); String url = prop.getProperty("url"); String user = prop.getProperty("user"); String password = prop.getProperty("password"); Class.forName(driver); connection = DriverManager.getConnection(url, user, password); connection.setAutoCommit(true); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return connection; }
From source file:com.atlassian.theplugin.commons.ssl.PluginSSLProtocolSocketFactory.java
public static void initializeSocketFactory(GeneralConfigurationBean generalConfiguration, CertMessageDialog dialog) {//from www . ja va2 s . c o m PluginSSLProtocolSocketFactory.generalConfigurationBean = generalConfiguration; PluginSSLProtocolSocketFactory.certMessageDialog = dialog; Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new PluginSSLProtocolSocketFactory(), EasySSLProtocolSocketFactory.SSL_PORT)); try { Class.forName(SocketFactoryFactory.class.getCanonicalName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } AxisProperties.setClassDefault(SecureSocketFactory.class, PluginSSLProtocolSocketFactory.class.getCanonicalName()); }
From source file:maltcms.ui.fileHandles.properties.tools.PropertyLoader.java
/** * @param optionValues/*ww w. j av a2 s .c o m*/ */ public static String[] getListServiceProviders(String optionValue) { List<String> ret = new ArrayList<>(); Class<?> c; try { c = Class.forName(optionValue); Logger.getLogger(PropertyLoader.class.getName()).log(Level.INFO, "Loading service: {0}", c.getName()); ServiceLoader<?> sl = ServiceLoader.load(c); for (Object o : sl) { if (o != null) { ret.add(o.getClass().getName()); } } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (Exception | Error e) { e.printStackTrace(); } if (ret.size() == 0) { return new String[] { "Can not find any Services for " + optionValue }; } else { return ret.toArray(new String[] {}); } }
From source file:InlineTestStringsProvider.java
public static Class<?> loadInlineClassIfNeeded(String className) { try {/*from ww w. j a v a 2s . co m*/ // If the class can be loaded, just return it. Class c = Class.forName(className); return c; } catch (Exception e) { // Initialize the class loader with a parent that is the InlineTestStringProvider class DDTClassLoader ddtClassLoader = new DDTClassLoader(InlineTestStringsProvider.class.getClassLoader()); try { Class aClass = ddtClassLoader.loadClass(className); if (!isBlank(ddtClassLoader.getErrors())) System.out.println( "Class " + sq(className) + " Not loaded due to errors: " + ddtClassLoader.getErrors()); else System.out.println("Class " + sq(className) + " loaded."); return aClass; } catch (ClassNotFoundException notFoundException) { System.out.println("Class " + sq(className) + " Not Loaded due to errors:"); notFoundException.printStackTrace(); } } return null; }
From source file:Operacional.Janela2.java
static Class class$(String s) { try {/*from w ww. j a v a2 s .c o m*/ return Class.forName(s); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } ClassNotFoundException classnotfoundexception = null; throw new NoClassDefFoundError(classnotfoundexception.getMessage()); }
From source file:org.apache.kylin.common.metrics.perflog.PerfLoggerFactory.java
public static IPerfLogger getPerfLogger(boolean resetPerfLogger) { IPerfLogger result = perfLogger.get(); if (resetPerfLogger || result == null) { try {//from w w w. j av a2 s. c om result = (IPerfLogger) ClassUtils .getClass(KylinConfig.getInstanceFromEnv().getPerfLoggerClassName()).newInstance(); } catch (ClassNotFoundException e) { LOG.error("Performance Logger Class not found:" + e.getMessage()); result = new SimplePerfLogger(); } catch (IllegalAccessException | InstantiationException e) { e.printStackTrace(); } perfLogger.set(result); } return result; }
From source file:net.kamhon.ieagle.application.Application.java
private static void createGenericApplicationContext() { if (appContext == null) { appContext = new GenericApplicationContext(); Class<?> clazz = null; if (StringUtils.isNotBlank(clazzPath)) { try { clazz = Class.forName(clazzPath); } catch (ClassNotFoundException e) { e.printStackTrace(); }// w ww .j av a 2s.c om } ClassPathResource resource = null; if (contextPath.startsWith("classpath:")) { if (clazz == null) { resource = new ClassPathResource(contextPath.substring("classpath:".length())); } else { resource = new ClassPathResource(contextPath.substring("classpath:".length()), clazz); } } else { if (clazz == null) { resource = new ClassPathResource(contextPath); } else { resource = new ClassPathResource(contextPath, clazz); } } BeanDefinitionReader reader = new XmlBeanDefinitionReader((BeanDefinitionRegistry) appContext); reader.loadBeanDefinitions(resource); ((GenericApplicationContext) appContext).refresh(); } }
From source file:org.objectweb.proactive.extensions.timitspmd.util.charts.Utilities.java
/** * For each tag <chart> in configuration file, try to generate a chart * according to its parameters/*from w w w.j av a 2s. c o m*/ * * @param serieResults * merged values * @param bstats * full statistics (used for non-mergable values like commevents) * @param charts * array from <chart> tags in configuration file */ public static void generatingCharts(Element eTimitResult, BenchmarkStatistics bstats, ConfigChart[] charts) { if (charts == null) { return; } TimIt.message(2, "Generating charts..."); String className = null; for (ConfigChart cChart : charts) { TimIt.message(4, "Generating " + cChart.get("title") + " [" + cChart.get("subtitle") + "]" + "..."); try { className = Utilities.class.getPackage().getName() + "." + cChart.get("type"); Class<?> chartClass = Class.forName(className); Chart chart = (Chart) chartClass.newInstance(); chart.generateChart(eTimitResult, bstats, cChart); } catch (ClassNotFoundException e) { System.err.println(" Fail: Unknown chart type: " + className); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } }
From source file:edu.harvard.i2b2.fhir.Utils.java
public static Class getClassFromClassPath(String resourceName) { ClassLoader loader = Utils.class.getClassLoader(); try {//from w w w .j a v a2s .co m return Class.forName(resourceName, false, loader); } catch (ClassNotFoundException e) { logger.error("Class Not Found for:" + resourceName, e); e.printStackTrace(); return null; } }
From source file:info.usbo.skypetwitter.Run.java
public static int load_file() { // TWITTER/*from w w w . j a va 2 s .c o m*/ try { FileInputStream fis = new FileInputStream(work_dir + "\\twitter_ids.data"); ObjectInputStream ois = new ObjectInputStream(fis); twitter_ids = (ArrayList) ois.readObject(); ois.close(); fis.close(); } catch (IOException ioe) { ioe.printStackTrace(); return 0; } catch (ClassNotFoundException c) { System.out.println("Class not found"); c.printStackTrace(); return 0; } // VK try { FileInputStream fis = new FileInputStream(work_dir + "\\vk_ids.data"); ObjectInputStream ois = new ObjectInputStream(fis); vk_ids = (ArrayList) ois.readObject(); ois.close(); fis.close(); } catch (IOException ioe) { ioe.printStackTrace(); return 0; } catch (ClassNotFoundException c) { System.out.println("Class not found"); c.printStackTrace(); return 0; } return 1; }