List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:com.bevyios.gcm.BevyGcmListenerService.java
public Class getMainActivityClass() { try {// w ww .ja v a2s . com String packageName = getApplication().getPackageName(); return Class.forName(packageName + ".MainActivity"); } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } }
From source file:org.twilmes.sql.gremlin.plugin.SqlRemoteAcceptor.java
@Override public Object connect(final List<String> args) throws RemoteException { // Driver class isn't automatically loaded on plugin startup so // we do it the old fashioned way here. Not sure why Calcite // needs this even though we're not using the jdbc driver yet. try {/*from www.ja v a 2 s. co m*/ Class.forName("org.apache.calcite.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (args.size() != 2) { throw new IllegalArgumentException("Usage: :remote connect " + SqlGremlinPlugin.NAME + " <variable name of graph or graph traversal source> <schema file>"); } final Object graphOrTraversalSource = this.shell.getInterp().getContext().getVariable(args.get(0)); final String schemaFn = (String) this.shell.getInterp().getContext().getVariable(args.get(1)); if (graphOrTraversalSource instanceof Graph) { this.g = ((Graph) graphOrTraversalSource).traversal(); } else { this.g = (GraphTraversalSource) graphOrTraversalSource; } // Read the schema config in and intialize the compiler. final ObjectMapper mapper = new ObjectMapper(); try { final SchemaConfig schemaConfig = mapper.readValue(new File(schemaFn), SchemaConfig.class); compiler = new GremlinCompiler(g.getGraph().get(), schemaConfig); } catch (final Exception e) { throw new RemoteException(e); } return this; }
From source file:com.persistent.cloudninja.utils.ProvisionConnectionUtility.java
public Connection getConnection(String url, String db_name, String db_user, String db_user_pwd) { Connection connection = null; int index = url.indexOf("="); String connUrl = url.substring(0, index + 1) + db_name + ";"; try {//from w w w. java2 s . com Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); connection = DriverManager.getConnection(connUrl, db_user, db_user_pwd); } catch (InstantiationException instantiationException) { instantiationException.printStackTrace(); } catch (IllegalAccessException illegalAccessException) { illegalAccessException.printStackTrace(); } catch (ClassNotFoundException classNotFoundException) { classNotFoundException.printStackTrace(); } catch (SQLException sqlException) { sqlException.printStackTrace(); } return connection; }
From source file:org.openmrs.module.kenyaemr.calculation.CalculationManager.java
/** * Refreshes registered calculation classes *///from w ww. j av a 2 s . com public synchronized void refresh() { clear(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false); scanner.addIncludeFilter(new AssignableTypeFilter(BaseEmrCalculation.class)); for (BeanDefinition bd : scanner.findCandidateComponents(CalculationManager.class.getPackage().getName())) { try { Class clazz = Class.forName(bd.getBeanClassName()); calculationClasses.put(bd.getBeanClassName(), clazz); } catch (ClassNotFoundException e) { e.printStackTrace(); } log.info("Found calculation class :" + bd.getBeanClassName()); } }
From source file:com.sky.projects.pool.jdbc.JdbcConnectionFactory.java
private void loadDriver() { try {//from w w w .j ava2s . c o m Class.forName(driverClass); } catch (ClassNotFoundException e) { e.printStackTrace(); } }
From source file:org.apache.myriad.MyriadTestModule.java
@SuppressWarnings("unchecked") @Override//www . ja v a2 s. c o m protected void configure() { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); try { cfg = mapper.readValue( Thread.currentThread().getContextClassLoader().getResource("myriad-config-test-default.yml"), MyriadConfiguration.class); } catch (IOException e1) { LOGGER.error("IOException", e1); return; } if (cfg == null) { return; } bind(MyriadConfiguration.class).toInstance(cfg); MapBinder<String, TaskFactory> mapBinder = MapBinder.newMapBinder(binder(), String.class, TaskFactory.class); mapBinder.addBinding(NodeManagerConfiguration.DEFAULT_NM_TASK_PREFIX).to(NMTaskFactory.class) .in(Scopes.SINGLETON); Map<String, ServiceConfiguration> auxServicesConfigs = cfg.getServiceConfigurations(); for (Map.Entry<String, ServiceConfiguration> entry : auxServicesConfigs.entrySet()) { String taskFactoryClass = entry.getValue().getTaskFactoryImplName().orNull(); if (taskFactoryClass != null) { try { Class<? extends TaskFactory> implClass = (Class<? extends TaskFactory>) Class .forName(taskFactoryClass); mapBinder.addBinding(entry.getKey()).to(implClass).in(Scopes.SINGLETON); } catch (ClassNotFoundException e) { e.printStackTrace(); } } else { mapBinder.addBinding(entry.getKey()).to(ServiceTaskFactory.class).in(Scopes.SINGLETON); } } }
From source file:org.openmrs.module.kenyacore.calculation.CalculationManager.java
/** * @see org.openmrs.module.kenyacore.ContentManager#refresh() */// w w w. j a va2s. c o m @Override public synchronized void refresh() { calculationClasses.clear(); flagCalculationClasses.clear(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider( false); scanner.addIncludeFilter(new AssignableTypeFilter(PatientCalculation.class)); for (BeanDefinition bd : scanner.findCandidateComponents("org.openmrs.module")) { try { Class<? extends PatientCalculation> clazz = (Class<? extends PatientCalculation>) Context .loadClass(bd.getBeanClassName()); calculationClasses.put(bd.getBeanClassName(), clazz); if (PatientFlagCalculation.class.isAssignableFrom(clazz)) { flagCalculationClasses.add((Class<? extends PatientFlagCalculation>) clazz); } } catch (ClassNotFoundException e) { e.printStackTrace(); } log.debug("Registered calculation class " + bd.getBeanClassName()); } }
From source file:ca.uwaterloo.iss4e.hadoop.io.CartesianInputFormat.java
@Override public List<InputSplit> getSplits(JobContext job) throws IOException { try {/* w w w . j a v a 2s . c o m*/ // Get the input splits from both the left and right data sets Configuration conf = job.getConfiguration(); List<InputSplit> leftSplits = getInputSplits(job, conf.get(LEFT_INPUT_FORMAT), new Path(conf.get(LEFT_INPUT_PATH))); List<InputSplit> rightSplits = getInputSplits(job, conf.get(RIGHT_INPUT_FORMAT), new Path(conf.get(RIGHT_INPUT_PATH))); // Create our CompositeInputSplits, size equal to left.length * // right.length List<InputSplit> compoisteInputSplits = new ArrayList<InputSplit>(); // For each of the left input splits for (InputSplit left : leftSplits) { // For each of the right input splits for (InputSplit right : rightSplits) { // Create a new composite input split composing of the // two CompositeInputSplit returnSplits = new CompositeInputSplit(2); returnSplits.add(left); returnSplits.add(right); compoisteInputSplits.add(returnSplits); } } // Return the composite splits LOG.info("Total CompositeSplits to process: " + compoisteInputSplits.size()); return compoisteInputSplits; } catch (ClassNotFoundException e) { e.printStackTrace(); throw new IOException(e); } catch (InterruptedException e) { e.printStackTrace(); throw new IOException(e); } }
From source file:net.mjc.zip.domain.IdCheck.java
public Intent createIntent(Context context) { try {//from w w w . java 2s.c om Intent intent = new Intent(context, Class.forName(getActivityClass())); if (intent.resolveActivity(context.getPackageManager()) != null) { return intent; } } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; }
From source file:maltcms.ui.fileHandles.serialized.JFCLoader.java
@Override public JFreeChart call() throws Exception { ph.start(100);//from ww w. java2 s . c om JFreeChart chart = null; try { ph.progress("Opening file", 33); try (ObjectInputStream ois = new ObjectInputStream( new BufferedInputStream(new FileInputStream(filename)))) { ph.progress("Reading object", 66); chart = (JFreeChart) ois.readObject(); } } catch (final ClassNotFoundException e) { ph.progress("ClassNotFoundException", 80); e.printStackTrace(); } catch (final IOException e) { ph.progress("IOException", 80); e.printStackTrace(); } ph.progress("Finished!", 100); ph.finish(); return chart; }