List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:gridool.db.partitioning.monetdb.MonetDBInvokeCopyIntoOperation.java
@Override public Serializable execute() throws SQLException { final Connection conn; try {//from ww w .j av a 2 s. c o m conn = getConnection(); } catch (ClassNotFoundException e) { LOG.error(e); throw new SQLException(e.getMessage()); } final File loadFile = prepareLoadFile(tableName); final String query = complementCopyIntoQuery(copyIntoQuery, loadFile); try { JDBCUtils.update(conn, query); conn.commit(); } catch (SQLException e) { LOG.error("rollback a transaction", e); conn.rollback(); throw e; } finally { try { conn.close(); } catch (SQLException e) { LOG.debug(e); } if (!loadFile.delete()) { LOG.warn("Could not remove a tempolary file: " + loadFile.getAbsolutePath()); } } return Boolean.TRUE; }
From source file:com.jroossien.boxx.nms.NMS.java
public <T> Object loadFromNMS(Class<T> dep, Object... objects) { if (!dep.isAnnotationPresent(NMSDependant.class)) return null; NMSDependant nmsDependant = dep.getAnnotation(NMSDependant.class); Class<?> impl = null;// ww w . j av a 2 s . c om try { impl = Class.forName(nmsDependant.implementationPath() + "." + dep.getSimpleName() + "_" + version); return ConstructorUtils.invokeConstructor(impl, objects); } catch (ClassNotFoundException e) { Boxx.get().error("The current version is not supported: " + version + ".\n" + e.getMessage()); } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { e.printStackTrace(); } return impl; }
From source file:org.apache.hadoop.hbase.trace.SpanReceiverHost.java
/** * Reads the names of classes specified in the * "hbase.trace.spanreceiver.classes" property and instantiates and registers * them with the Tracer as SpanReceiver's. * *//*from www .j a v a 2s . c om*/ public void loadSpanReceivers() { Class<?> implClass = null; String[] receiverNames = conf.getStrings(SPAN_RECEIVERS_CONF_KEY); if (receiverNames == null || receiverNames.length == 0) { return; } for (String className : receiverNames) { className = className.trim(); try { implClass = Class.forName(className); SpanReceiver receiver = loadInstance(implClass); if (receiver != null) { receivers.add(receiver); LOG.info("SpanReceiver " + className + " was loaded successfully."); } } catch (ClassNotFoundException e) { LOG.warn("Class " + className + " cannot be found. " + e.getMessage()); } catch (IOException e) { LOG.warn("Load SpanReceiver " + className + " failed. " + e.getMessage()); } } for (SpanReceiver rcvr : receivers) { Trace.addReceiver(rcvr); } }
From source file:org.apache.sling.testing.teleporter.client.DefaultPropertyBasedCustomizer.java
@Override public void customize(TeleporterRule rule, String options) { final ClientSideTeleporter cst = (ClientSideTeleporter) rule; if (StringUtils.isBlank(baseUrl)) { fail("The mandatory system property " + PROPERTY_BASE_URL + " is not set!"); }/*from w w w . j a v a 2 s . c om*/ cst.setBaseUrl(baseUrl); cst.setServerCredentials(serverUsername, serverPassword); cst.setTestReadyTimeoutSeconds(testReadyTimeout); if (StringUtils.isNotBlank(includeDependencyPrefixes)) { for (String includeDependencyPrefix : includeDependencyPrefixes.split(LIST_SEPARATOR)) { if (StringUtils.isNotBlank(includeDependencyPrefix)) { cst.includeDependencyPrefix(includeDependencyPrefix); } } } if (StringUtils.isNotBlank(excludeDependencyPrefixes)) { for (String excludeDependencyPrefix : excludeDependencyPrefixes.split(LIST_SEPARATOR)) { if (StringUtils.isNotBlank(excludeDependencyPrefix)) { cst.excludeDependencyPrefix(excludeDependencyPrefix); } } } if (StringUtils.isNotBlank(embedClasses)) { for (String embedClass : embedClasses.split(LIST_SEPARATOR)) { if (StringUtils.isNotBlank(embedClass)) { try { Class<?> clazz = this.getClass().getClassLoader().loadClass(embedClass); cst.embedClass(clazz); } catch (ClassNotFoundException e) { fail("Could not load class with name '" + embedClass + "': " + e.getMessage()); } } } } }
From source file:org.ala.harvester.RawFileHarvestRunner.java
/** * Harvest info sources in list/*from w ww.j av a2 s . com*/ * * @param infoSourceIds */ private void harvest(List<Integer> infoSourceIds) { for (Integer id : infoSourceIds) { logger.info("Harvesting infosource id: " + id); try { this.harvest(id); } catch (ClassNotFoundException ex) { logger.error("Error - ClassNotFoundException: " + ex.getMessage()); } catch (InstantiationException ex) { logger.error("Error - InstantiationException: " + ex.getMessage()); } catch (IllegalAccessException ex) { logger.error("Error - IllegalAccessException: " + ex.getMessage()); } catch (Exception ex) { logger.error("Error - Exception: " + ex.getMessage()); } } }
From source file:TransactionConnectionServlet.java
public void init(ServletConfig config) throws ServletException { super.init(config); try {/*from ww w. ja v a2 s .co m*/ // load the driver Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); } catch (ClassNotFoundException e) { throw new UnavailableException( "TransactionConnection.init() ClassNotFoundException: " + e.getMessage()); } catch (IllegalAccessException e) { throw new UnavailableException( "TransactionConnection.init() IllegalAccessException: " + e.getMessage()); } catch (InstantiationException e) { throw new UnavailableException( "TransactionConnection.init() InstantiationException: " + e.getMessage()); } }
From source file:com.threewks.thundr.deferred.DeferredTaskService.java
private void run(String message) { DeferredTask deferredTask = null;/*from ww w. j a va2s . co m*/ try { deferredTask = serializer.deserialize(message); deferredTask.run(); } catch (ClassNotFoundException e) { String errorMessage = "Unable to deserialize task from queue. Class %s not found."; Logger.error(errorMessage, e.getMessage()); throw new ThundrDeferredException(e, errorMessage, e.getMessage()); } catch (Exception e) { Logger.error("Running deferred task failed. Cause: %s", ExceptionUtils.getStackTrace(e)); if (deferredTask != null && deferredTask instanceof RetryableDeferredTask) { Logger.info("Task is retryable, attempting to schedule retry...", e.getMessage()); attemptRetry(((RetryableDeferredTask) deferredTask)); } else { Logger.warn("Task is not retryable. Giving up!"); throw new ThundrDeferredException(e, "Running deferred task failed permanently. Reason: %s", e.getMessage()); } } }
From source file:org.apache.tika.parser.jdbc.AbstractDBParser.java
/** * Override this for special configuration of the connection, such as limiting * the number of rows to be held in memory. * * @param stream stream to use/*from w w w.jav a2 s. com*/ * @param metadata metadata that could be used in parameterizing the connection * @param context parsecontext that could be used in parameterizing the connection * @return connection * @throws java.io.IOException * @throws org.apache.tika.exception.TikaException */ protected Connection getConnection(InputStream stream, Metadata metadata, ParseContext context) throws IOException, TikaException { String connectionString = getConnectionString(stream, metadata, context); Connection connection = null; try { Class.forName(getJDBCClassName()); } catch (ClassNotFoundException e) { throw new TikaException(e.getMessage()); } try { connection = DriverManager.getConnection(connectionString); } catch (SQLException e) { throw new IOExceptionWithCause(e); } return connection; }
From source file:com.revolsys.ui.web.config.JavaComponent.java
private void setClassName(final String className) { this.className = className; try {//from w w w . jav a2s. co m this.componentClass = Class.forName(className); } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e.getMessage()); } try { this.setPropertyMethod = this.componentClass.getMethod("setProperty", SET_PROPERTY_ARGS); } catch (final NoSuchMethodException e) { throw new IllegalArgumentException("Class " + className + " must have a method with the signature 'public void setProperty(String name, Object value)'"); } try { this.serializeMethod = this.componentClass.getMethod("serialize", SERIALIZE_METHOD_ARGS); } catch (final NoSuchMethodException e) { throw new IllegalArgumentException("Class " + className + " must have a method with the signature 'public void serialize(Writer out) throws IOException'"); } }
From source file:com.assignment.Product.java
private Connection getConnection() throws SQLException { Connection conn = null;//from ww w.ja v a2s . com try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { System.err.println("JDBC Driver Not Found: " + ex.getMessage()); } try { String jdbc = "jdbc:mysql://ipro.lambton.on.ca/inventory"; conn = DriverManager.getConnection(jdbc, "products", "products"); } catch (SQLException ex) { System.err.println("Failed to Connect: " + ex.getMessage()); } return conn; }