List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:com.jaspersoft.ireport.designer.data.fieldsproviders.BeanInspectorPanel.java
public void exploreBean(DefaultMutableTreeNode root, String classname, String parentPath) { try {// w w w . j a v a 2 s. c o m root.removeAllChildren(); if (parentPath.length() > 0) parentPath += "."; Class clazz = Class.forName(classname, true, IReportManager.getInstance().getReportClassLoader()); java.beans.PropertyDescriptor[] pd = org.apache.commons.beanutils.PropertyUtils .getPropertyDescriptors(clazz); for (int nd = 0; nd < pd.length; ++nd) { String fieldName = pd[nd].getName(); if (pd[nd].getPropertyType() != null && pd[nd].getReadMethod() != null) { Class clazzRT = pd[nd].getPropertyType(); if (clazzRT.isPrimitive()) { clazzRT = MethodUtils.getPrimitiveWrapper(clazzRT); } String returnType = clazzRT.getName(); JRDesignField field = new JRDesignField(); field.setName(fieldName); field.setValueClassName(returnType); if (isPathOnDescription()) { field.setDescription(parentPath + fieldName); } else { field.setName(parentPath + fieldName); } TreeJRField jtf = new TreeJRField(); jtf.setField(field); jtf.setObj(pd[nd].getPropertyType()); boolean bChildrens = true; if (pd[nd].getPropertyType().isPrimitive() || pd[nd].getPropertyType().getName().startsWith("java.lang.")) { bChildrens = false; } root.add(new DefaultMutableTreeNode(jtf, bChildrens)); } } jTree1.expandPath(new TreePath(root.getPath())); jTree1.updateUI(); } catch (ClassNotFoundException cnf) { javax.swing.JOptionPane.showMessageDialog(this, Misc.formatString( //"messages.BeanInspectorPanel.classNotFoundError", I18n.getString("BeanInspectorPanel.Message.Error"), new Object[] { cnf.getMessage() }), I18n.getString("BeanInspectorPanel.Message.Error2"), javax.swing.JOptionPane.ERROR_MESSAGE); return; } catch (Exception ex) { ex.printStackTrace(); javax.swing.JOptionPane.showMessageDialog(this, ex.getMessage(), I18n.getString("BeanInspectorPanel.Message.Error2"), javax.swing.JOptionPane.ERROR_MESSAGE); return; } }
From source file:com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory.java
/** * Gets the custom retry policy.//w w w .j a va2 s. co m * * @param props * the props * @return the custom retry policy * @throws ClassNotFoundException * @throws IllegalAccessException * @throws NoSuchMethodException * @throws InvocationTargetException * @throws Exception * the exception */ private com.datastax.driver.core.policies.RetryPolicy getCustomRetryPolicy(Properties props) { String customRetryPolicy = (String) props.get(CUSTOM_RETRY_POLICY); Class<?> clazz = null; Method getter = null; try { clazz = Class.forName(customRetryPolicy); com.datastax.driver.core.policies.RetryPolicy retryPolicy = (com.datastax.driver.core.policies.RetryPolicy) KunderaCoreUtils .createNewInstance(clazz); if (retryPolicy != null) { return retryPolicy; } getter = clazz.getDeclaredMethod(GET_INSTANCE); return (com.datastax.driver.core.policies.RetryPolicy) getter.invoke(null, (Object[]) null); } catch (ClassNotFoundException e) { logger.error(e.getMessage()); throw new KunderaException("Please make sure class " + customRetryPolicy + " set in property file exists in classpath " + e.getMessage()); } catch (IllegalAccessException e) { logger.error(e.getMessage()); throw new KunderaException("Method " + getter.getName() + " must be declared public " + e.getMessage()); } catch (NoSuchMethodException e) { logger.error(e.getMessage()); throw new KunderaException( "Please make sure getter method of " + clazz.getSimpleName() + " is named \"getInstance()\""); } catch (InvocationTargetException e) { logger.error(e.getMessage()); throw new KunderaException("Error while executing \"getInstance()\" method of Class " + clazz.getSimpleName() + ": " + e.getMessage()); } }
From source file:com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory.java
/** * Gets the host filter predicate.// w w w . j a v a 2s .c om * * @param hostFilterPolicy * the host filter policy * @return the host filter predicate */ private Predicate<com.datastax.driver.core.Host> getHostFilterPredicate(String hostFilterPolicy) { Predicate<com.datastax.driver.core.Host> predicate = null; Method getter = null; Class<?> hostFilterClazz = null; try { hostFilterClazz = Class.forName(hostFilterPolicy); getter = hostFilterClazz.getDeclaredMethod(GET_INSTANCE); predicate = (Predicate<com.datastax.driver.core.Host>) getter .invoke(KunderaCoreUtils.createNewInstance(hostFilterClazz)); } catch (ClassNotFoundException e) { logger.error(e.getMessage()); throw new KunderaException("Please make sure class " + hostFilterPolicy + " set in property file exists in classpath " + e.getMessage()); } catch (IllegalAccessException e) { logger.error(e.getMessage()); throw new KunderaException("Method " + getter.getName() + " must be declared public " + e.getMessage()); } catch (NoSuchMethodException e) { logger.error(e.getMessage()); throw new KunderaException("Please make sure getter method of " + hostFilterClazz.getSimpleName() + " is named \"getInstance()\""); } catch (InvocationTargetException e) { logger.error(e.getMessage()); throw new KunderaException("Error while executing \"getInstance()\" method of Class " + hostFilterClazz.getSimpleName() + ": " + e.getMessage()); } catch (SecurityException e) { logger.error(e.getMessage()); throw new KunderaException("Encountered security exception while accessing the method: " + "\"getInstance()\"" + e.getMessage()); } return predicate; }
From source file:org.apache.beehive.netui.pageflow.MultipartRequestUtils.java
/** * Create an implementation of a {@link MultipartRequestHandler} for this * mulitpart request.//from w ww . jav a 2 s. co m * * @param request the current request object * @return the handler * @throws ServletException if an error occurs loading this file. These exception messages * are not internationalized as Struts does not internationalize them either. */ // @Struts: org.apache.struts.util.RequestUtils.getMultipartHandler private static final MultipartRequestHandler getMultipartHandler(HttpServletRequest request) throws ServletException { MultipartRequestHandler multipartHandler = null; String multipartClass = (String) request.getAttribute(Globals.MULTIPART_KEY); request.removeAttribute(Globals.MULTIPART_KEY); // Try to initialize the mapping specific request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { _log.error("MultipartRequestHandler class \"" + multipartClass + "\" in mapping class not found, " + "defaulting to global multipart class"); } catch (InstantiationException ie) { _log.error( "InstantiaionException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { _log.error( "IllegalAccessException when instantiating " + "MultipartRequestHandler \"" + multipartClass + "\", " + "defaulting to global multipart class, exception: " + iae.getMessage()); } if (multipartHandler != null) return multipartHandler; } ModuleConfig moduleConfig = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY); multipartClass = moduleConfig.getControllerConfig().getMultipartClass(); // Try to initialize the global request handler if (multipartClass != null) { try { multipartHandler = (MultipartRequestHandler) RequestUtils.applicationInstance(multipartClass); } catch (ClassNotFoundException cnfe) { throw new ServletException("Cannot find multipart class \"" + multipartClass + "\"" + ", exception: " + cnfe.getMessage()); } catch (InstantiationException ie) { throw new ServletException("InstantiaionException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + ie.getMessage()); } catch (IllegalAccessException iae) { throw new ServletException("IllegalAccessException when instantiating " + "multipart class \"" + multipartClass + "\", exception: " + iae.getMessage()); } if (multipartHandler != null) return multipartHandler; } return multipartHandler; }
From source file:services.GoogleComputeEngineService.java
public void createTestNodes(Integer testNodes, String machineType, String sourceImage, Integer rootDiskSizeGb) throws GoogleComputeEngineException, GoogleCloudStorageException { List<String> tags; SSHKey sshKey = SSHKeyFactory.generateKey(); StringBuilder machinePrefix = new StringBuilder(); machinePrefix.append("https://www.googleapis.com/compute/v1/projects/"); machinePrefix.append(client.getProjectId()); machinePrefix.append("/zones/"); machinePrefix.append(client.getZone()); machinePrefix.append("/machineTypes/"); String clusterName = ConfigurationService.getClusterName(); if (clusterName == null) { throw new GoogleComputeEngineException( "cluster is not created, you must create a cluster before to create the testing nodes"); }/*from w w w . ja va 2s . co m*/ /** * Get the cluster network */ String clusterNetwork = getClusterNetwork(); /** * Verify the machine type to get the proper Link */ for (MachineType t : client.getMachineTypes()) { if (machineType != null && machineType.equals(t.getName())) { machineType = t.getSelfLink(); break; } } /** * Verify the source image to get the proper Link */ for (Image i : client.getImages()) { if (sourceImage != null && sourceImage.equals(i.getName())) { sourceImage = i.getSelfLink(); break; } } /** * Overwrites the SSH key */ try { SSHKeyStore store = new SSHKeyStore(); store.addKey(ConfigurationService.TEST_USER, sshKey); } catch (ClassNotFoundException e) { log.info("cannot store cluster ssh key on disk: " + e.getMessage()); throw new GoogleComputeEngineException(e); } catch (IOException e) { log.info("cannot store cluster ssh key on disk: " + e.getMessage()); throw new GoogleComputeEngineException(e); } /** * Creates the jump server */ String instanceName = ConfigurationService.getServerName(clusterName, ConfigurationService.NODE_NAME_TEST_JUMP); tags = Arrays.asList(ConfigurationService.NODE_TAG_TEST_JUMP, clusterName); if (!client.instanceExists(instanceName)) { String networkName = clusterNetwork; if (networkName.contains("/")) { networkName = networkName.substring(networkName.lastIndexOf("/") + 1); } File startupScript = ConfigurationService.getTestJumpNodeStartupScriptFile(clusterName, networkName); try { client.createInstance(instanceName, machinePrefix.toString().concat("n1-standard-1"), Arrays.asList(clusterNetwork), rootDiskSizeGb, sourceImage, null, tags, Arrays.asList(sshKey.getSSHPublicKey(ConfigurationService.TEST_USER)), startupScript.getAbsolutePath(), true); } finally { startupScript.delete(); } } else { log.info("instance [" + instanceName + "] already exists, not created"); } /** * Put the test node creation task in a background thread */ final File t_startupScript = ConfigurationService.getTestNodeStartupScriptFile(clusterName); final String t_instanceName = ConfigurationService.getServerName(clusterName, ConfigurationService.NODE_NAME_TEST); final List<String> t_tags = Arrays.asList(ConfigurationService.NODE_TAG_TEST, clusterName); final String t_machineType = machineType; final String t_sourceImage = sourceImage; Runnable testNodesCreation = () -> { /** * Time to start and configure the jump server */ try { Thread.sleep(10000); } catch (InterruptedException e) { } try { for (Integer i = 1; i <= testNodes; i++) { StringBuilder instance_name = new StringBuilder(); instance_name.append(t_instanceName); instance_name.append("-node-"); instance_name.append(i); if (client.instanceExists(instance_name.toString())) { log.info("instance [" + instance_name.toString() + "] already exists, not created"); continue; } client.createInstance(instance_name.toString(), t_machineType, Arrays.asList(clusterNetwork), rootDiskSizeGb, t_sourceImage, null, t_tags, Arrays.asList(sshKey.getSSHPublicKey(ConfigurationService.TEST_USER)), t_startupScript.getAbsolutePath(), false); } log.info("Test nodes creation finished"); } catch (GoogleComputeEngineException e) { log.error("Test nodes creation error: " + e.getMessage()); } }; Thread thread = new Thread(testNodesCreation); thread.start(); }
From source file:org.blazr.extrastorage.ExtraStorage.java
public boolean compilationSuccess() { try {/*from ww w. ja v a 2 s . c o m*/ Class.forName("org.blazr.extrastorage.CommandsHandler"); Class.forName("org.blazr.extrastorage.EventHandlers"); Class.forName("org.blazr.extrastorage.ExtraStorageAPI"); Class.forName("org.blazr.extrastorage.Import"); Class.forName("org.blazr.extrastorage.IO"); Class.forName("org.blazr.extrastorage.VNPCompat"); Class.forName("org.blazr.extrastorage.json.JSONArray"); Class.forName("org.blazr.extrastorage.json.JSONException"); Class.forName("org.blazr.extrastorage.json.JSONObject"); Class.forName("org.blazr.extrastorage.json.JSONString"); Class.forName("org.blazr.extrastorage.json.JSONStringer"); Class.forName("org.blazr.extrastorage.json.JSONTokener"); Class.forName("org.blazr.extrastorage.json.JSONWriter"); Class.forName("org.blazr.extrastorage.util.Metrics"); Class.forName("org.blazr.extrastorage.util.Updater"); return true; } catch (ClassNotFoundException e) { getLogger().severe("######################################################"); getLogger().severe("######################################################"); getLogger().severe("The class '" + e.getMessage() + "' wasn't compiled !!!"); getLogger().severe("######################################################"); getLogger().severe("######################################################"); return false; } }
From source file:org.apache.hadoop.hive.ql.optimizer.ConvertJoinMapJoin.java
@SuppressWarnings("unchecked") private Object checkAndConvertSMBJoin(OptimizeTezProcContext context, JoinOperator joinOp, TezBucketJoinProcCtx tezBucketJoinProcCtx) throws SemanticException { // we cannot convert to bucket map join, we cannot convert to // map join either based on the size. Check if we can convert to SMB join. if (context.conf.getBoolVar(HiveConf.ConfVars.HIVE_AUTO_SORTMERGE_JOIN) == false) { fallbackToReduceSideJoin(joinOp, context); return null; }/* www .j a v a 2 s .co m*/ Class<? extends BigTableSelectorForAutoSMJ> bigTableMatcherClass = null; try { String selector = HiveConf.getVar(context.parseContext.getConf(), HiveConf.ConfVars.HIVE_AUTO_SORTMERGE_JOIN_BIGTABLE_SELECTOR); bigTableMatcherClass = JavaUtils.loadClass(selector); } catch (ClassNotFoundException e) { throw new SemanticException(e.getMessage()); } BigTableSelectorForAutoSMJ bigTableMatcher = ReflectionUtils.newInstance(bigTableMatcherClass, null); JoinDesc joinDesc = joinOp.getConf(); JoinCondDesc[] joinCondns = joinDesc.getConds(); Set<Integer> joinCandidates = MapJoinProcessor.getBigTableCandidates(joinCondns); if (joinCandidates.isEmpty()) { // This is a full outer join. This can never be a map-join // of any type. So return false. return false; } int mapJoinConversionPos = bigTableMatcher.getBigTablePosition(context.parseContext, joinOp, joinCandidates); if (mapJoinConversionPos < 0) { // contains aliases from sub-query // we are just converting to a common merge join operator. The shuffle // join in map-reduce case. fallbackToReduceSideJoin(joinOp, context); return null; } if (checkConvertJoinSMBJoin(joinOp, context, mapJoinConversionPos, tezBucketJoinProcCtx)) { convertJoinSMBJoin(joinOp, context, mapJoinConversionPos, tezBucketJoinProcCtx.getNumBuckets(), true); } else { // we are just converting to a common merge join operator. The shuffle // join in map-reduce case. fallbackToReduceSideJoin(joinOp, context); } return null; }
From source file:com.snaplogic.snaps.firstdata.Transaction.java
@Override public void defineInputSchema(final SchemaProvider provider) { for (String viewName : provider.getRegisteredViewNames()) { if (viewName.equals(DEFAULT_INPUT_VIEW_0)) { SchemaBuilder schemaBuilder = provider.getSchemaBuilder(viewName); editorProperty.getSchema(schemaBuilder, viewName); } else {//from w w w . j a v a 2 s .c o m Class<?> classType = null; try { classType = Class.forName(getGMFReqClassType()); } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); throw new ExecutionException(e.getMessage()); } try { SchemaBuilder schemaBuilder = provider.getSchemaBuilder(viewName); schemaBuilder.withChildSchema(getSchema(provider, classType, SnapType.STRING)); schemaBuilder.build(); } catch (Exception e) { log.error(e.getMessage(), e); } } } }
From source file:org.apache.storm.daemon.nimbus.NimbusUtils.java
@SuppressWarnings("rawtypes") @ClojureClass(className = "backtype.storm.daemon.nimbus#nimbus-data#:validator") public static ITopologyValidator mkTopologyValidator(Map conf) { String topology_validator = (String) conf.get(Config.NIMBUS_TOPOLOGY_VALIDATOR); ITopologyValidator validator = null; if (topology_validator != null) { try {//from www . j a v a 2 s .c o m validator = ReflectionUtils.newInstance(topology_validator); } catch (ClassNotFoundException e) { LOG.error(e.getMessage(), e); throw new RuntimeException("Fail to make configed NIMBUS_TOPOLOGY_VALIDATOR"); } } else { validator = new DefaultTopologyValidator(); } return validator; }
From source file:com.sec.ose.airs.service.protex.ProtexSDKAPIService.java
public void setProtexServerProxyObject(Object protexServerProxyObject) throws Exception { try {//w w w . jav a 2 s . c o m protexServerProxyClass = Class.forName(protexServerProxyClassName); } catch (ClassNotFoundException e) { log.error(e.getMessage()); throw e; } this.protexServerProxyObject = protexServerProxyObject; this.setAPIs(); }