List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:org.jfree.chart.demo.JDBCCategoryChartDemo.java
private CategoryDataset readData() { JDBCCategoryDataset jdbccategorydataset = null; String s = "jdbc:postgresql://localhost/jfreechartdb"; try {// www. j av a 2 s . co m Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException classnotfoundexception) { System.err.print("ClassNotFoundException: "); System.err.println(classnotfoundexception.getMessage()); } try { Connection connection = DriverManager.getConnection(s, "jfreechart", "password"); jdbccategorydataset = new JDBCCategoryDataset(connection); String s1 = "SELECT * FROM CATEGORYDATA1;"; System.out.println("Once..."); jdbccategorydataset.executeQuery(s1); System.out.println("Again..."); jdbccategorydataset.executeQuery(s1); System.out.println("Done."); connection.close(); } catch (SQLException sqlexception) { System.err.print("SQLException: "); System.err.println(sqlexception.getMessage()); } catch (Exception exception) { System.err.print("Exception: "); System.err.println(exception.getMessage()); } return jdbccategorydataset; }
From source file:org.jbr.commons.container.java.JavaSpringContainer.java
/** * Obtains the single JavaConfig class used to register when building this * container's application context. By default, this looks toward a JVM * parameter by the name <code>JavaSpringContainer.contextConfigClass</code> * for the configuration classname. This behavior, however, is overriden if * the classname is passed as a constructor parameter. * /*from w w w .j a v a2 s . co m*/ * @return the context configuration class * @throws SpringContainerException * if unable to find the configuration classname specified by * the JVM parameter */ public Class<?> getContextConfigClass() throws SpringContainerException { if (contextConfigClass != null) return contextConfigClass; else { try { final String configClassname = System.getProperty(JVM_PARM_CONTEXT_CONFIG_CLASS); Assert.notNull(configClassname, "Missing '" + JVM_PARM_CONTEXT_CONFIG_CLASS + "' JVM parameter! " + "Required to bootstrap " + getClass().getSimpleName() + "!"); return Class.forName(configClassname); } catch (final ClassNotFoundException e) { throw new SpringContainerException(e.getMessage(), e); } } }
From source file:TestApplet.java
public void init() { try {//ww w . j a v a 2s .com System.out.println("init(): loading OracleDriver for applet created at " + created.toString()); Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("init(): getting connection"); conn = DriverManager.getConnection("jdbc:oracle:thin:@dssw2k01:1521:orcl", "scott", "tiger"); } catch (ClassNotFoundException e) { System.err.println("init(): ClassNotFoundException: " + e.getMessage()); } catch (SQLException e) { System.err.println("init(): SQLException: " + e.getMessage()); } }
From source file:fr.paris.lutece.plugins.mylutece.modules.oauth.authentication.OAuthAuthenticationFactory.java
/** * * @param strOAuthProtocolVersion the protocol version * @return the new OAuthAuthentication instance *//*from ww w. j a va 2 s.c o m*/ public OAuthAuthentication newAuthentication(String strOAuthProtocolVersion) { String strClassName = _mapClasses.get(strOAuthProtocolVersion); if (strClassName != null) { Class<OAuthAuthentication> clazz; try { clazz = ClassUtils.getClass(strClassName); return clazz.newInstance(); } catch (ClassNotFoundException e) { AppLogService.error(e.getMessage(), e); } catch (InstantiationException e) { AppLogService.error(e.getMessage(), e); } catch (IllegalAccessException e) { AppLogService.error(e.getMessage(), e); } } throw new AppException("Unsupported protocol version for " + strOAuthProtocolVersion); }
From source file:TestAppletNetscape.java
public void init() { try {//from ww w . j a v a 2s .com System.out.println("init(): loading OracleDriver for applet created at " + created.toString()); Class.forName("oracle.jdbc.driver.OracleDriver"); PrivilegeManager.enablePrivilege("UniversalConnect"); System.out.println("init(): getting connection"); PrivilegeManager.checkPrivilegeEnabled("UniversalConnect"); conn = DriverManager.getConnection("jdbc:oracle:thin:@dssnt01:1521:dssora01", "scott", "tiger"); } catch (ClassNotFoundException e) { System.err.println("init(): ClassNotFoundException: " + e.getMessage()); } catch (SQLException e) { System.err.println("init(): SQLException: " + e.getMessage()); } }
From source file:org.zalando.spring.boot.async.AsyncExecutorConfiguration.java
@Override public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { try {/*from w w w .jav a2 s . c om*/ return (AsyncUncaughtExceptionHandler) Class.forName(properties.getExceptionHandler()).newInstance(); } catch (ClassNotFoundException e) { throw new RuntimeException(e.getMessage(), e); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:com.metawiring.load.activity.dispensers.DirectImplActivityDispenser.java
@SuppressWarnings("unchecked") public DirectImplActivityDispenser(String activityClassName, String activityName) { try {/* w w w . j av a 2 s. c o m*/ this.activityClass = (Class<? extends Activity>) Class.forName(activityClassName); this.activityName = activityName; } catch (ClassNotFoundException e) { logger.error("Unable to find class " + activityClassName + ": " + e.getMessage()); throw new RuntimeException(e); } }
From source file:gridool.util.GridMessageBuffer.java
public GridCommunicationMessage toMessage() { final InputStream is = new FastByteArrayInputStream(msgBuf.getInternalArray(), 0, msgBuf.size()); try {/*from www .j a v a 2s. c om*/ return ObjectUtils.readObject(is); } catch (IOException ioe) { LOG.error(ioe.getMessage()); throw new IllegalStateException(ioe); } catch (ClassNotFoundException cnfe) { LOG.error(cnfe.getMessage()); throw new IllegalStateException(cnfe); } catch (Throwable te) { LOG.fatal(te.getMessage(), te); throw new IllegalStateException(te); } }
From source file:ru.trett.cis.rest.CommonAPI.java
private Class getModelClass(String className) throws ClassMappingException { Reflections reflections = new Reflections("ru.trett.cis.models"); Set<Class<? extends BaseEntity>> classes = reflections.getSubTypesOf(BaseEntity.class); Set<String> classNames = new LinkedHashSet<>(); classes.forEach(x -> classNames.add(x.getSimpleName())); if (!classNames.contains(className)) throw new ClassMappingException("Class is not Model."); try {/*from w ww .jav a 2 s . co m*/ return Class.forName("ru.trett.cis.models." + className); } catch (ClassNotFoundException e) { LOGGER.error(e.getMessage()); return null; } }
From source file:org.apache.hadoop.hive.ql.plan.PlanUtils.java
public static TableDesc getDefaultTableDesc(CreateTableDesc directoryDesc, String cols, String colTypes) { TableDesc ret = getDefaultTableDesc(Integer.toString(Utilities.ctrlaCode), cols, colTypes, false); ;/*from w ww . j a v a2 s.c o m*/ if (directoryDesc == null) { return ret; } try { Properties properties = ret.getProperties(); if (directoryDesc.getFieldDelim() != null) { properties.setProperty(serdeConstants.FIELD_DELIM, directoryDesc.getFieldDelim()); properties.setProperty(serdeConstants.SERIALIZATION_FORMAT, directoryDesc.getFieldDelim()); } if (directoryDesc.getLineDelim() != null) { properties.setProperty(serdeConstants.LINE_DELIM, directoryDesc.getLineDelim()); } if (directoryDesc.getCollItemDelim() != null) { properties.setProperty(serdeConstants.COLLECTION_DELIM, directoryDesc.getCollItemDelim()); } if (directoryDesc.getMapKeyDelim() != null) { properties.setProperty(serdeConstants.MAPKEY_DELIM, directoryDesc.getMapKeyDelim()); } if (directoryDesc.getFieldEscape() != null) { properties.setProperty(serdeConstants.ESCAPE_CHAR, directoryDesc.getFieldEscape()); } if (directoryDesc.getSerName() != null) { properties.setProperty(serdeConstants.SERIALIZATION_LIB, directoryDesc.getSerName()); } if (directoryDesc.getOutputFormat() != null) { ret.setOutputFileFormatClass(JavaUtils.loadClass(directoryDesc.getOutputFormat())); } if (directoryDesc.getNullFormat() != null) { properties.setProperty(serdeConstants.SERIALIZATION_NULL_FORMAT, directoryDesc.getNullFormat()); } if (directoryDesc.getTblProps() != null) { properties.putAll(directoryDesc.getTblProps()); } } catch (ClassNotFoundException e) { // mimicking behaviour in CreateTableDesc tableDesc creation // returning null table description for output. LOG.warn("Unable to find class in getDefaultTableDesc: " + e.getMessage(), e); return null; } return ret; }