List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:org.apache.ignite.yardstick.cache.load.IgniteCacheRandomOperationBenchmark.java
/** * @throws Exception If failed.// w w w. j a v a 2 s.c om */ private void searchCache() throws Exception { availableCaches = new ArrayList<>(ignite().cacheNames().size()); txCaches = new ArrayList<>(); affCaches = new ArrayList<>(); keysCacheClasses = new HashMap<>(); valuesCacheClasses = new HashMap<>(); replaceEntryProc = new BenchmarkReplaceValueEntryProcessor(null); rmvEntryProc = new BenchmarkRemoveEntryProcessor(); cacheSqlDescriptors = new HashMap<>(); operationStatistics = new HashMap<>(); loadQueries(); loadAllowedOperations(); for (String cacheName : ignite().cacheNames()) { IgniteCache<Object, Object> cache = ignite().cache(cacheName); for (Operation op : Operation.values()) operationStatistics.put(op + "_" + cacheName, new AtomicLong(0)); CacheConfiguration configuration = cache.getConfiguration(CacheConfiguration.class); if (isClassDefinedInConfig(configuration)) { if (configuration.getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED && configuration.getQueryEntities().size() > 2) { throw new IgniteException( "Off-heap mode is unsupported by the load test due to bugs IGNITE-2982" + " and IGNITE-2997"); } ArrayList<Class> keys = new ArrayList<>(); ArrayList<Class> values = new ArrayList<>(); if (configuration.getQueryEntities() != null) { Collection<QueryEntity> entries = configuration.getQueryEntities(); for (QueryEntity queryEntity : entries) { try { if (queryEntity.getKeyType() != null) { Class keyCls = Class.forName(queryEntity.getKeyType()); if (ModelUtil.canCreateInstance(keyCls)) keys.add(keyCls); else throw new IgniteException("Class is unknown for the load test. Make sure you " + "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); } if (queryEntity.getValueType() != null) { Class valCls = Class.forName(queryEntity.getValueType()); if (ModelUtil.canCreateInstance(valCls)) values.add(valCls); else throw new IgniteException("Class is unknown for the load test. Make sure you " + "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); configureCacheSqlDescriptor(cacheName, queryEntity, valCls); } } catch (ClassNotFoundException e) { BenchmarkUtils.println(e.getMessage()); BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception."); if (!cacheSqlDescriptors.containsKey(cacheName)) cacheSqlDescriptors.put(cacheName, new ArrayList<SqlCacheDescriptor>()); } } } if (configuration.getTypeMetadata() != null) { Collection<CacheTypeMetadata> entries = configuration.getTypeMetadata(); for (CacheTypeMetadata cacheTypeMetadata : entries) { try { if (cacheTypeMetadata.getKeyType() != null) { Class keyCls = Class.forName(cacheTypeMetadata.getKeyType()); if (ModelUtil.canCreateInstance(keyCls)) keys.add(keyCls); else throw new IgniteException("Class is unknown for the load test. Make sure you " + "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); } if (cacheTypeMetadata.getValueType() != null) { Class valCls = Class.forName(cacheTypeMetadata.getValueType()); if (ModelUtil.canCreateInstance(valCls)) values.add(valCls); else throw new IgniteException("Class is unknown for the load test. Make sure you " + "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); } } catch (ClassNotFoundException e) { BenchmarkUtils.println(e.getMessage()); BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception."); if (!cacheSqlDescriptors.containsKey(cacheName)) cacheSqlDescriptors.put(cacheName, new ArrayList<SqlCacheDescriptor>()); } } } keysCacheClasses.put(cacheName, keys.toArray(new Class[] {})); valuesCacheClasses.put(cacheName, values.toArray(new Class[] {})); } else keysCacheClasses.put(cacheName, new Class[] { randomKeyClass(cacheName) }); valuesCacheClasses.put(cacheName, determineValueClasses(cacheName)); if (configuration.getCacheMode() != CacheMode.LOCAL) affCaches.add(cache); if (configuration.getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL) txCaches.add(cache); availableCaches.add(cache); } }
From source file:com.espertech.esperio.http.EsperIOHTTPAdapter.java
/** * Start the DDS endpoint.//from w w w. ja v a 2s .c om */ public synchronized void start() { if (log.isInfoEnabled()) { log.info("Starting EsperIO HTTP Adapter for engine URI '" + engineURI + "'"); } EPServiceProviderSPI engineSPI = (EPServiceProviderSPI) EPServiceProviderManager.getProvider(engineURI); // Start requests (output adapter) for (Request request : config.getRequests()) { EventType eventType = engineSPI.getEventAdapterService().getExistsTypeByName(request.getStream()); if (eventType == null) { throw new ConfigurationException("Event type by name '" + request.getStream() + "' not found"); } try { EsperIOHTTPSubscription subs = new EsperIOHTTPSubscription(request.getStream(), request.getUri()); subs.seteventTypeName(request.getStream()); subs.setSubscriptionName("EsperIOHTTP-" + request.getUri()); subs.registerAdapter(engineSPI); } catch (Throwable t) { log.error( "Error starting HTTP Request definition for URI " + request.getUri() + "'" + t.getMessage(), t); } } // Configure services (input adapter) Set<Integer> ports = new HashSet<Integer>(); for (Map.Entry<String, Service> entry : config.getServices().entrySet()) { if (services.containsKey(entry.getKey())) { throw new ConfigurationException( "A service by name '" + entry.getKey() + "' has already been configured."); } int port = entry.getValue().getPort(); if (ports.contains(port)) { throw new ConfigurationException("A service for port '" + port + "' has already been configured."); } ports.add(port); EsperHttpServiceBase httpService; if (entry.getValue().isNio()) { try { Class.forName("org.apache.http.nio.NHttpServiceHandler"); } catch (ClassNotFoundException e) { throw new ConfigurationException( "NIO Handler not found in classpath, please ensure httpcore-nio exists in classpath."); } httpService = new EsperHttpServiceNIO(entry.getKey(), entry.getValue()); } else { httpService = new EsperHttpServiceClassic(entry.getKey(), entry.getValue()); } services.put(entry.getKey(), httpService); } // Add handlers (input adapter) for (GetHandler handler : config.getGetHandlers()) { if (!services.containsKey(handler.getService())) { throw new ConfigurationException( "A service by name '" + handler.getService() + "' has not been configured."); } EsperHttpServiceBase httpService = services.get(handler.getService()); httpService.add(handler); } // Start services for (EsperHttpServiceBase service : services.values()) { try { service.start(engineSPI); } catch (IOException e) { log.error("Error starting service '" + service.getServiceName() + "' :" + e.getMessage()); } } if (log.isInfoEnabled()) { log.info("Completed starting EsperIO HTTP Adapter for engine URI '" + engineURI + "'."); } }
From source file:com.gemstone.gemfire.management.internal.cli.functions.DataCommandFunction.java
@SuppressWarnings({ "rawtypes" }) public DataCommandResult put(String key, String value, boolean putIfAbsent, String keyClass, String valueClass, String regionName) {/* www .j av a2s .c om*/ if (regionName == null || regionName.isEmpty()) { return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__REGIONNAME_EMPTY, false); } if (key == null || key.isEmpty()) { return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__KEY_EMPTY, false); } if (value == null || value.isEmpty()) { return DataCommandResult.createPutResult(key, null, null, CliStrings.PUT__MSG__VALUE_EMPTY, false); } Cache cache = CacheFactory.getAnyInstance(); Region region = cache.getRegion(regionName); if (region == null) { return DataCommandResult.createPutResult(key, null, null, CliStrings.format(CliStrings.PUT__MSG__REGION_NOT_FOUND, regionName), false); } else { Object keyObject = null; Object valueObject = null; try { keyObject = getClassObject(key, keyClass); } catch (ClassNotFoundException e) { return DataCommandResult.createPutResult(key, null, null, "ClassNotFoundException " + keyClass, false); } catch (IllegalArgumentException e) { return DataCommandResult.createPutResult(key, null, null, "Error in converting JSON " + e.getMessage(), false); } try { valueObject = getClassObject(value, valueClass); } catch (ClassNotFoundException e) { return DataCommandResult.createPutResult(key, null, null, "ClassNotFoundException " + valueClass, false); } Object returnValue; if (putIfAbsent && region.containsKey(keyObject)) returnValue = region.get(keyObject); else returnValue = region.put(keyObject, valueObject); Object array[] = getJSONForNonPrimitiveObject(returnValue); DataCommandResult result = DataCommandResult.createPutResult(key, array[1], null, null, true); if (array[0] != null) result.setValueClass((String) array[0]); return result; } }
From source file:org.apache.lens.ml.impl.LensMLImpl.java
/** * Inits the./*from ww w . j a v a 2 s. c o m*/ * * @param hiveConf the hive conf */ public synchronized void init(HiveConf hiveConf) { this.conf = hiveConf; // Get all the drivers String[] driverClasses = hiveConf.getStrings("lens.ml.drivers"); if (driverClasses == null || driverClasses.length == 0) { throw new RuntimeException("No ML Drivers specified in conf"); } log.info("Loading drivers " + Arrays.toString(driverClasses)); drivers = new ArrayList<MLDriver>(driverClasses.length); for (String driverClass : driverClasses) { Class<?> cls; try { cls = Class.forName(driverClass); } catch (ClassNotFoundException e) { log.error("Driver class not found " + driverClass, e); continue; } if (!MLDriver.class.isAssignableFrom(cls)) { log.warn("Not a driver class " + driverClass); continue; } try { Class<? extends MLDriver> mlDriverClass = (Class<? extends MLDriver>) cls; MLDriver driver = mlDriverClass.newInstance(); driver.init(toLensConf(conf)); drivers.add(driver); log.info("Added driver " + driverClass); } catch (Exception e) { log.error("Failed to create driver " + driverClass + " reason: " + e.getMessage(), e); } } if (drivers.isEmpty()) { throw new RuntimeException("No ML drivers loaded"); } log.info("Inited ML service"); }
From source file:com.gemstone.gemfire.management.internal.cli.functions.DataCommandFunction.java
@SuppressWarnings({ "rawtypes" }) public DataCommandResult get(String key, String keyClass, String valueClass, String regionName, Boolean loadOnCacheMiss) { Cache cache = CacheFactory.getAnyInstance(); if (regionName == null || regionName.isEmpty()) { return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__REGIONNAME_EMPTY, false); }//from w ww .j av a 2 s . c om if (key == null || key.isEmpty()) { return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__KEY_EMPTY, false); } Region region = cache.getRegion(regionName); if (region == null) { if (logger.isDebugEnabled()) logger.debug("Region Not Found - {}", regionName); return DataCommandResult.createGetResult(key, null, null, CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND, regionName), false); } else { Object keyObject = null; try { keyObject = getClassObject(key, keyClass); } catch (ClassNotFoundException e) { return DataCommandResult.createGetResult(key, null, null, "ClassNotFoundException " + keyClass, false); } catch (IllegalArgumentException e) { return DataCommandResult.createGetResult(key, null, null, "Error in converting JSON " + e.getMessage(), false); } // TODO determine whether the following conditional logic (assigned to 'doGet') is safer or necessary //boolean doGet = (Boolean.TRUE.equals(loadOnCacheMiss) && region.getAttributes().getCacheLoader() != null); boolean doGet = Boolean.TRUE.equals(loadOnCacheMiss); if (doGet || region.containsKey(keyObject)) { Object value = region.get(keyObject); if (logger.isDebugEnabled()) logger.debug("Get for key {} value {}", key, value); //return DataCommandResult.createGetResult(key, value, null, null); Object array[] = getJSONForNonPrimitiveObject(value); if (value != null) { DataCommandResult result = DataCommandResult.createGetResult(key, array[1], null, null, true); if (array[0] != null) result.setValueClass((String) array[0]); return result; } else { return DataCommandResult.createGetResult(key, array[1], null, null, false); } } else { if (logger.isDebugEnabled()) logger.debug("Key is not present in the region {}", regionName); return DataCommandResult.createGetInfoResult(key, null, null, CliStrings.GET__MSG__KEY_NOT_FOUND_REGION, false); } } }
From source file:org.apache.wiki.PageManager.java
/** * Creates a new PageManager./*from www.ja v a 2 s. c o m*/ * * @param engine WikiEngine instance * @param props Properties to use for initialization * @throws WikiException If anything goes wrong, you get this. */ public PageManager(WikiEngine engine, Properties props) throws WikiException { super(engine); String classname; m_engine = engine; boolean useCache = "true".equals(props.getProperty(PROP_USECACHE)); m_expiryTime = TextUtil.parseIntParameter(props.getProperty(PROP_LOCKEXPIRY), 60); // // If user wants to use a cache, then we'll use the CachingProvider. // if (useCache) { classname = "org.apache.wiki.providers.CachingProvider"; } else { classname = TextUtil.getRequiredProperty(props, PROP_PAGEPROVIDER); } try { log.debug("Page provider class: '" + classname + "'"); Class providerclass = ClassUtil.findClass("org.apache.wiki.providers", classname); m_provider = (WikiPageProvider) providerclass.newInstance(); log.debug("Initializing page provider class " + m_provider); m_provider.initialize(m_engine, props); } catch (ClassNotFoundException e) { log.error("Unable to locate provider class '" + classname + "'", e); throw new WikiException("No provider class.", e); } catch (InstantiationException e) { log.error("Unable to create provider class '" + classname + "'", e); throw new WikiException("Faulty provider class.", e); } catch (IllegalAccessException e) { log.error("Illegal access to provider class '" + classname + "'", e); throw new WikiException("Illegal provider class.", e); } catch (NoRequiredPropertyException e) { log.error("Provider did not found a property it was looking for: " + e.getMessage(), e); throw e; // Same exception works. } catch (IOException e) { log.error("An I/O exception occurred while trying to create a new page provider: " + classname, e); throw new WikiException("Unable to start page provider: " + e.getMessage(), e); } }
From source file:org.apache.wiki.auth.authorize.GroupManager.java
/** * Returns the current external {@link GroupDatabase} in use. This method * is guaranteed to return a properly-initialized GroupDatabase, unless * it could not be initialized. In that case, this method throws * a {@link org.apache.wiki.api.exceptions.WikiException}. The GroupDatabase * is lazily initialized./*from w w w .jav a 2s .c o m*/ * @throws org.apache.wiki.auth.WikiSecurityException if the GroupDatabase could * not be initialized * @return the current GroupDatabase * @since 2.3 */ public final GroupDatabase getGroupDatabase() throws WikiSecurityException { if (m_groupDatabase != null) { return m_groupDatabase; } String dbClassName = "<unknown>"; String dbInstantiationError = null; Throwable cause = null; try { Properties props = m_engine.getWikiProperties(); dbClassName = props.getProperty(PROP_GROUPDATABASE); if (dbClassName == null) { dbClassName = XMLGroupDatabase.class.getName(); } log.info("Attempting to load group database class " + dbClassName); Class<?> dbClass = ClassUtil.findClass("org.apache.wiki.auth.authorize", dbClassName); m_groupDatabase = (GroupDatabase) dbClass.newInstance(); m_groupDatabase.initialize(m_engine, m_engine.getWikiProperties()); log.info("Group database initialized."); } catch (ClassNotFoundException e) { log.error("GroupDatabase class " + dbClassName + " cannot be found.", e); dbInstantiationError = "Failed to locate GroupDatabase class " + dbClassName; cause = e; } catch (InstantiationException e) { log.error("GroupDatabase class " + dbClassName + " cannot be created.", e); dbInstantiationError = "Failed to create GroupDatabase class " + dbClassName; cause = e; } catch (IllegalAccessException e) { log.error("You are not allowed to access group database class " + dbClassName + ".", e); dbInstantiationError = "Access GroupDatabase class " + dbClassName + " denied"; cause = e; } catch (NoRequiredPropertyException e) { log.error("Missing property: " + e.getMessage() + "."); dbInstantiationError = "Missing property: " + e.getMessage(); cause = e; } if (dbInstantiationError != null) { throw new WikiSecurityException( dbInstantiationError + " Cause: " + (cause != null ? cause.getMessage() : ""), cause); } return m_groupDatabase; }
From source file:org.apache.geode.management.internal.cli.functions.DataCommandFunction.java
@SuppressWarnings({ "rawtypes" }) public DataCommandResult get(Object principal, String key, String keyClass, String valueClass, String regionName, Boolean loadOnCacheMiss) { Cache cache = CacheFactory.getAnyInstance(); if (regionName == null || regionName.isEmpty()) { return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__REGIONNAME_EMPTY, false); }//w ww .j a va2 s .c o m if (key == null || key.isEmpty()) { return DataCommandResult.createGetResult(key, null, null, CliStrings.GET__MSG__KEY_EMPTY, false); } Region region = cache.getRegion(regionName); if (region == null) { if (logger.isDebugEnabled()) logger.debug("Region Not Found - {}", regionName); return DataCommandResult.createGetResult(key, null, null, CliStrings.format(CliStrings.GET__MSG__REGION_NOT_FOUND, regionName), false); } else { Object keyObject = null; try { keyObject = getClassObject(key, keyClass); } catch (ClassNotFoundException e) { return DataCommandResult.createGetResult(key, null, null, "ClassNotFoundException " + keyClass, false); } catch (IllegalArgumentException e) { return DataCommandResult.createGetResult(key, null, null, "Error in converting JSON " + e.getMessage(), false); } // TODO determine whether the following conditional logic (assigned to 'doGet') is safer or // necessary // boolean doGet = (Boolean.TRUE.equals(loadOnCacheMiss) && // region.getAttributes().getCacheLoader() != null); boolean doGet = Boolean.TRUE.equals(loadOnCacheMiss); if (doGet || region.containsKey(keyObject)) { Object value = region.get(keyObject); // run it through post processor. region.get will return the deserialized object already, so // we don't need to // deserialize it anymore to pass it to the postProcessor value = this.securityService.postProcess(principal, regionName, keyObject, value, false); if (logger.isDebugEnabled()) logger.debug("Get for key {} value {}", key, value); // return DataCommandResult.createGetResult(key, value, null, null); Object array[] = getJSONForNonPrimitiveObject(value); if (value != null) { DataCommandResult result = DataCommandResult.createGetResult(key, array[1], null, null, true); if (array[0] != null) result.setValueClass((String) array[0]); return result; } else { return DataCommandResult.createGetResult(key, array[1], null, null, false); } } else { if (logger.isDebugEnabled()) logger.debug("Key is not present in the region {}", regionName); return DataCommandResult.createGetInfoResult(key, null, null, CliStrings.GET__MSG__KEY_NOT_FOUND_REGION, false); } } }
From source file:com.ecyrd.jspwiki.PageManager.java
/** * Creates a new PageManager.//from w ww . j a v a 2 s . c om * * @param engine WikiEngine instance * @param props Properties to use for initialization * @throws WikiException If anything goes wrong, you get this. */ public PageManager(WikiEngine engine, Properties props) throws WikiException { super(engine); String classname; m_engine = engine; boolean useCache = "true".equals(props.getProperty(PROP_USECACHE)); m_expiryTime = TextUtil.parseIntParameter(props.getProperty(PROP_LOCKEXPIRY), 60); // // If user wants to use a cache, then we'll use the CachingProvider. // if (useCache) { classname = "com.ecyrd.jspwiki.providers.CachingProvider"; } else { classname = WikiEngine.getRequiredProperty(props, PROP_PAGEPROVIDER); } try { log.debug("Page provider class: '" + classname + "'"); Class providerclass = ClassUtil.findClass("com.ecyrd.jspwiki.providers", classname); m_provider = (WikiPageProvider) providerclass.newInstance(); log.debug("Initializing page provider class " + m_provider); m_provider.initialize(m_engine, props); } catch (ClassNotFoundException e) { log.error("Unable to locate provider class '" + classname + "'", e); throw new WikiException("No provider class.", e); } catch (InstantiationException e) { log.error("Unable to create provider class '" + classname + "'", e); throw new WikiException("Faulty provider class.", e); } catch (IllegalAccessException e) { log.error("Illegal access to provider class '" + classname + "'", e); throw new WikiException("Illegal provider class.", e); } catch (NoRequiredPropertyException e) { log.error("Provider did not found a property it was looking for: " + e.getMessage(), e); throw e; // Same exception works. } catch (IOException e) { log.error("An I/O exception occurred while trying to create a new page provider: " + classname, e); throw new WikiException("Unable to start page provider: " + e.getMessage(), e); } }
From source file:com.ecyrd.jspwiki.auth.authorize.GroupManager.java
/** * Returns the current external {@link GroupDatabase} in use. This method * is guaranteed to return a properly-initialized GroupDatabase, unless * it could not be initialized. In that case, this method throws * a {@link com.ecyrd.jspwiki.WikiException}. The GroupDatabase * is lazily initialized.// w w w. j ava2 s. com * @throws com.ecyrd.jspwiki.auth.WikiSecurityException if the GroupDatabase could * not be initialized * @return the current GroupDatabase * @since 2.3 */ public final GroupDatabase getGroupDatabase() throws WikiSecurityException { if (m_groupDatabase != null) { return m_groupDatabase; } String dbClassName = "<unknown>"; String dbInstantiationError = null; Throwable cause = null; try { Properties props = m_engine.getWikiProperties(); dbClassName = props.getProperty(PROP_GROUPDATABASE); if (dbClassName == null) { dbClassName = XMLGroupDatabase.class.getName(); } log.info("Attempting to load group database class " + dbClassName); Class<?> dbClass = ClassUtil.findClass("com.ecyrd.jspwiki.auth.authorize", dbClassName); m_groupDatabase = (GroupDatabase) dbClass.newInstance(); m_groupDatabase.initialize(m_engine, m_engine.getWikiProperties()); log.info("Group database initialized."); } catch (ClassNotFoundException e) { log.error("GroupDatabase class " + dbClassName + " cannot be found.", e); dbInstantiationError = "Failed to locate GroupDatabase class " + dbClassName; cause = e; } catch (InstantiationException e) { log.error("GroupDatabase class " + dbClassName + " cannot be created.", e); dbInstantiationError = "Failed to create GroupDatabase class " + dbClassName; cause = e; } catch (IllegalAccessException e) { log.error("You are not allowed to access group database class " + dbClassName + ".", e); dbInstantiationError = "Access GroupDatabase class " + dbClassName + " denied"; cause = e; } catch (NoRequiredPropertyException e) { log.error("Missing property: " + e.getMessage() + "."); dbInstantiationError = "Missing property: " + e.getMessage(); cause = e; } if (dbInstantiationError != null) { throw new WikiSecurityException( dbInstantiationError + " Cause: " + (cause != null ? cause.getMessage() : ""), cause); } return m_groupDatabase; }