List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:com.netscape.certsrv.client.PKIConnection.java
private void handleErrorResponse(Response response) { StatusType status = response.getStatusInfo(); MediaType contentType = response.getMediaType(); if (!MediaType.APPLICATION_XML_TYPE.equals(contentType) && !MediaType.APPLICATION_JSON_TYPE.equals(contentType)) throw new PKIException(status.getStatusCode(), status.getReasonPhrase()); PKIException.Data data = response.readEntity(PKIException.Data.class); Class<?> exceptionClass; try {//w w w . ja v a 2 s. c o m exceptionClass = Class.forName(data.getClassName()); } catch (ClassNotFoundException e) { throw new PKIException(e.getMessage(), e); } try { throw (PKIException) exceptionClass.getConstructor(PKIException.Data.class).newInstance(data); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new PKIException(e.getMessage(), e); } }
From source file:net.skyebook.osmgenerator.DBActions.java
/** * Constructor - Creates (opens) the SQL connection *//* w w w . j a v a 2 s .com*/ public DBActions(String user, String pass, String dbName) { try { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + dbName, pass, pass); System.out.println("Preparing statements"); insertNode = con .prepareStatement("INSERT INTO nodes (id, latitude, longitude, tags) VALUES (?, ?, ?, ?)"); insertNodeNullTags = con .prepareStatement("INSERT INTO nodes (id, latitude, longitude) VALUES (?, ?, ?)"); insertWay = con.prepareStatement("INSERT INTO ways (id, tags) VALUES (?, ?)"); insertWayNullTags = con.prepareStatement("INSERT INTO ways (id) VALUES (?)"); insertWayMember = con.prepareStatement("INSERT INTO way_members (way, node) VALUES (?, ?)"); insertRelation = con.prepareStatement("INSERT INTO relations (id, tags) VALUES (?, ?)"); insertRelationNullTags = con.prepareStatement("INSERT INTO relations (id) VALUES (?)"); insertRelationMember = con .prepareStatement("INSERT INTO relation_members (relation, way, type) VALUES (?, ?, ?)"); bulkInsertNode = (Statement) con.createStatement(); bulkInsertWay = (Statement) con.createStatement(); bulkInsertWayMember = (Statement) con.createStatement(); bulkInsertRelation = (Statement) con.createStatement(); bulkInsertRleationMember = (Statement) con.createStatement(); System.out.println("Statements Prepared"); } catch (ClassNotFoundException e) { System.err.println("ClassNotFoundException: " + e.getMessage()); } catch (InstantiationException e) { System.err.println("InstantiationException: " + e.getMessage()); } catch (IllegalAccessException e) { System.err.println("IllegalAccessException: " + e.getMessage()); } } catch (SQLException e) { System.err.println("SQLException: " + e.getMessage()); System.err.println("SQLState: " + e.getSQLState()); System.err.println("VendorError: " + e.getErrorCode()); } }
From source file:org.apache.hadoop.hive.ql.optimizer.AbstractSMBJoinProc.java
protected boolean canConvertJoinToBucketMapJoin(JoinOperator joinOp, ParseContext pGraphContext, SortBucketJoinProcCtx context) throws SemanticException { // This has already been inspected and rejected if (context.getRejectedJoinOps().contains(joinOp)) { return false; }/*from w w w .ja v a 2 s. c om*/ QBJoinTree joinCtx = pGraphContext.getJoinContext().get(joinOp); if (joinCtx == null) { return false; } Class<? extends BigTableSelectorForAutoSMJ> bigTableMatcherClass = null; try { bigTableMatcherClass = (Class<? extends BigTableSelectorForAutoSMJ>) (Class.forName(HiveConf.getVar( pGraphContext.getConf(), HiveConf.ConfVars.HIVE_AUTO_SORTMERGE_JOIN_BIGTABLE_SELECTOR))); } catch (ClassNotFoundException e) { throw new SemanticException(e.getMessage()); } BigTableSelectorForAutoSMJ bigTableMatcher = (BigTableSelectorForAutoSMJ) ReflectionUtils .newInstance(bigTableMatcherClass, null); int bigTablePosition = bigTableMatcher.getBigTablePosition(pGraphContext, joinOp); if (bigTablePosition < 0) { // contains aliases from sub-query return false; } context.setBigTablePosition(bigTablePosition); String joinAlias = bigTablePosition == 0 ? joinCtx.getLeftAlias() : joinCtx.getRightAliases()[bigTablePosition - 1]; joinAlias = QB.getAppendedAliasFromId(joinCtx.getId(), joinAlias); Map<Byte, List<ExprNodeDesc>> keyExprMap = new HashMap<Byte, List<ExprNodeDesc>>(); List<Operator<? extends OperatorDesc>> parentOps = joinOp.getParentOperators(); // get the join keys from parent ReduceSink operators for (Operator<? extends OperatorDesc> parentOp : parentOps) { ReduceSinkDesc rsconf = ((ReduceSinkOperator) parentOp).getConf(); Byte tag = (byte) rsconf.getTag(); List<ExprNodeDesc> keys = rsconf.getKeyCols(); keyExprMap.put(tag, keys); } context.setKeyExprMap(keyExprMap); // Make a deep copy of the aliases so that they are not changed in the context String[] joinSrcs = joinCtx.getBaseSrc(); String[] srcs = new String[joinSrcs.length]; for (int srcPos = 0; srcPos < joinSrcs.length; srcPos++) { joinSrcs[srcPos] = QB.getAppendedAliasFromId(joinCtx.getId(), joinSrcs[srcPos]); srcs[srcPos] = new String(joinSrcs[srcPos]); } // Given a candidate map-join, can this join be converted. // The candidate map-join was derived from the pluggable sort merge join big // table matcher. return checkConvertBucketMapJoin(pGraphContext, context, joinCtx, keyExprMap, joinAlias, Arrays.asList(srcs)); }
From source file:com.ikon.util.cl.FilesystemClassLoader.java
/** * Find class//from ww w .j av a 2 s . c om */ @Override public Class<?> findClass(String className) { log.info("findClass({})", className); String classFile = className.replace('.', '/').concat(".class"); File fc = new File(file, classFile); FileInputStream fis = null; // Check for system class try { return findSystemClass(className); } catch (ClassNotFoundException e) { // Ignore } try { if (fc.exists() && fc.canRead()) { fis = new FileInputStream(fc); byte[] classByte = IOUtils.toByteArray(fis); if (classByte != null) { return defineClass(className, classByte, 0, classByte.length, null); } } } catch (IOException e) { log.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(fis); } return null; }
From source file:com.aliyun.odps.mapred.conf.SessionState.java
/** * From old Console load context file , include settings & aliases * * @return//w ww . j av a2s.co m */ @SuppressWarnings({ "unchecked", "rawtypes" }) private void loadContextFile(Properties prop) throws IOException { String fileName = prop.getProperty(OLD_CONTEXT_FILE); if (fileName == null) { return; } String jsonStr = FileUtils.readFileToString(new File(fileName)); Map context = JSON.parseObject(jsonStr, Map.class); if (context == null) { return; } // client set ignore certs to true when request from internal-cli internalCli = true; getOdps().getRestClient().setIgnoreCerts(true); if (context.containsKey("settings")) { Map<String, String> settings = (Map<String, String>) context.get("settings"); for (Entry<String, String> setting : settings.entrySet()) { defaultJob.set(setting.getKey(), setting.getValue()); } } if (context.containsKey("aliases")) { aliases = (Map<String, String>) context.get("aliases"); } if (context.containsKey("context")) { // extract info from execution context Map<String, Object> ctx = (Map<String, Object>) context.get("context"); defaultJob.setInstancePriority((Integer) ctx.get("priority")); OdpsHooks.clearRegisteredHooks(); String hookString = (String) ctx.get("odpsHooks"); if (!StringUtils.isNullOrEmpty(hookString)) { try { String[] hooks = hookString.split(","); List<Class<? extends OdpsHook>> hookList = new ArrayList<Class<? extends OdpsHook>>(); for (String hook : hooks) { hookList.add((Class<? extends OdpsHook>) Class.forName(hook)); } OdpsHooks.registerHooks(hookList); } catch (ClassNotFoundException e) { throw new IOException(e.getMessage(), e); } } String runningCluster = (String) ctx.get("runningCluster"); if (!StringUtils.isNullOrEmpty(runningCluster)) { odps.instances().setDefaultRunningCluster(runningCluster); } if (ctx.get("logViewHost") != null) { String logViewHost = (String) ctx.get("logViewHost"); odps.setLogViewHost(logViewHost); } if (ctx.containsKey("https_check")) { odps.getRestClient().setIgnoreCerts(!(Boolean) ctx.get("https_check")); } } if (context.containsKey("commandText")) { setCommandText((String) context.get("commandText")); } }
From source file:edu.emory.bmi.aiw.i2b2export.output.ProviderDataOutputFormatter.java
public void format(BufferedWriter writer) throws IOException { try {/*from w ww . j a v a2 s .c om*/ Class.forName("org.h2.Driver"); } catch (ClassNotFoundException ex) { throw new AssertionError("Error parsing i2b2 metadata: " + ex); } try (Connection con = DriverManager.getConnection("jdbc:h2:mem:ProviderDataOutputFormatter")) { for (Observer provider : this.providers) { new ProviderDataRowOutputFormatter(this.config, provider, con).format(writer); writer.write(IOUtils.LINE_SEPARATOR); } } catch (SQLException ex) { throw new IOException("Error parsing i2b2 metadata: " + ex.getMessage()); } }
From source file:io.swagger.inflector.config.Configuration.java
public void setModelMappings(Map<String, String> mappings) { for (String key : mappings.keySet()) { String className = mappings.get(key); Class<?> cls;/*from www. jav a 2 s .c om*/ try { ClassLoader classLoader = Configuration.class.getClassLoader(); cls = classLoader.loadClass(className); modelMap.put(key, cls); } catch (ClassNotFoundException e) { unimplementedModels.add(className); LOGGER.error("unable to add mapping for `" + key + "` : `" + className + "`, " + e.getMessage()); } } }
From source file:edu.emory.bmi.aiw.i2b2export.output.PatientDataOutputFormatter.java
public void format(BufferedWriter writer) throws IOException { try {//from w w w. ja v a2 s . c om Class.forName("org.h2.Driver"); } catch (ClassNotFoundException ex) { throw new AssertionError("Error parsing i2b2 metadata: " + ex); } try (Connection con = DriverManager.getConnection("jdbc:h2:mem:PatientDataOutputFormatter")) { for (Patient patient : this.patients) { new PatientDataRowOutputFormatter(getOutputConfiguration(), patient, con).format(writer); writer.write(IOUtils.LINE_SEPARATOR); } } catch (SQLException ex) { throw new IOException("Error parsing i2b2 metadata: " + ex.getMessage()); } }
From source file:de.micromata.genome.gwiki.jetty.GWikiInitialSetup.java
private boolean checkDbUrl(StandaloneDatabases db, String url, String user, String pass) { try {// w w w . j av a 2 s.c o m Class.forName(db.getDriver()); try (Connection con = DriverManager.getConnection(url, user, pass)) { try (Statement stmt = con.createStatement()) { message("Created DB Connection...."); } } return true; } catch (ClassNotFoundException e) { message("Cannot find db driver"); return false; } catch (SQLException e) { message("Cannot create connection: " + e.getMessage()); return false; } }
From source file:com.apporiented.spring.override.AbstractGenericBeanDefinitionParser.java
public AbstractGenericBeanDefinitionParser(String className) { try {/*from www.j av a 2 s. com*/ beanClass = Class.forName(className); } catch (ClassNotFoundException e) { throw new FatalBeanException("Can't find the bean class", e); } catch (NoClassDefFoundError e) { enabled = false; log.warn("Turning off support for " + className + " elements due to a missing dependency: " + e.getMessage()); } }