Example usage for java.lang ClassNotFoundException getMessage

List of usage examples for java.lang ClassNotFoundException getMessage

Introduction

In this page you can find the example usage for java.lang ClassNotFoundException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.aurel.track.lucene.LuceneUtil.java

/**
 * Initializes the lucene parameters from the the database 
 * (table TSite, field Preferences)  /*from   w  w  w .j av  a 2  s  . c  o m*/
 * @param site
 */
public static void configLuceneParameters(TSiteBean site) {
    //get useLucene 
    String useLuceneStr = site.getUseLucene();
    if (useLuceneStr == null || "".equals(useLuceneStr.trim())) {
        useLuceneStr = "false";
    }
    boolean useLucene = Boolean.valueOf(useLuceneStr).booleanValue();
    LuceneUtil.setUseLucene(useLucene);
    //get indexAttachments
    String indexAttachmentsStr = site.getIndexAttachments();
    if (indexAttachmentsStr == null || "".equals(indexAttachmentsStr.trim())) {
        indexAttachmentsStr = "false";
    }
    boolean indexAttachments = Boolean.valueOf(indexAttachmentsStr).booleanValue();
    LuceneUtil.setIndexAttachments(indexAttachments);
    //get reindexOnStartup
    String reindexOnStartupStr = site.getReindexOnStartup();
    if (reindexOnStartupStr == null || "".equals(reindexOnStartupStr.trim())) {
        reindexOnStartupStr = "false";
    }
    boolean reindexOnStartup = Boolean.valueOf(reindexOnStartupStr).booleanValue();
    LuceneUtil.setReindexOnStartup(reindexOnStartup);
    //get analyzerStr
    String analyzerStr = site.getAnalyzer();
    if (analyzerStr == null || "".equals(analyzerStr.trim())) {
        analyzerStr = StandardAnalyzer.class.getName();
    }
    //get the analyzer class
    Class analyzerClass = null;
    try {
        analyzerClass = Class.forName(analyzerStr.trim());
    } catch (ClassNotFoundException e) {
        LOGGER.error("Analyzer class not found. Fall back to StandardAnalyzer." + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    if (analyzerClass != null) {
        Class partypes[] = new Class[0];
        Constructor ct = null;
        try {
            ct = analyzerClass.getConstructor(partypes);
        } catch (Exception e) {
            LOGGER.info(
                    "Getting the Version based constructor for " + analyzerStr.trim() + " failed with " + e);
        }
        if (ct != null) {
            //Object arglist[] = new Object[1];
            //arglist[0] = LuceneUtil.VERSION;
            try {
                analyzer = (Analyzer) ct.newInstance(/*arglist*/);
            } catch (Exception e) {
                LOGGER.error("Instanciationg the Version based constructor for " + analyzerStr.trim()
                        + " failed with " + e);
            }
        }
        //then try it with implicit constructor (for earlier lucene versions)
        if (analyzer == null) {
            try {
                analyzer = (Analyzer) analyzerClass.newInstance();
                LOGGER.info("Instantiating the Analyzer through default constructor");
            } catch (Exception e) {
                LOGGER.error(
                        "Instantiating the Analyzer through default constructor failed with " + e.getMessage());
                LOGGER.debug(ExceptionUtils.getStackTrace(e));
            }
        }
    }
    if (analyzer == null) {
        LOGGER.warn("Fall back on creating a StandardAnalyzer instance");
        analyzer = new StandardAnalyzer();
    }
    LuceneUtil.setAnalyzer(analyzer);
    //get indexPath
    String indexPath = site.getIndexPath();
    if (indexPath == null) {
        indexPath = "";
    }
    LuceneUtil.setPath(indexPath);
}

From source file:com.linkedin.cubert.operator.CubeOperator.java

private static void createAggregators(JsonNode json, BlockSchema inputSchema, boolean hasInnerDimensions,
        List<CubeAggInfo> aggs, List<DupleCubeAggInfo> dupleAggs) throws PreconditionException {
    for (JsonNode aggregateJson : json.get("aggregates")) {
        JsonNode typeJson = aggregateJson.get("type");
        // validate that type is defined in json
        if (typeJson == null || typeJson.isNull())
            throw new PreconditionException(PreconditionExceptionType.INVALID_CONFIG,
                    "<type> property not defined in Json: " + typeJson.toString());

        // validate that type is a string or array
        if (!typeJson.isTextual() && !typeJson.isArray())
            throw new PreconditionException(PreconditionExceptionType.INVALID_CONFIG,
                    "<type> property not text or array: " + typeJson.toString());

        // if array, validate that type has one or two items
        if (typeJson.isArray() && !(typeJson.size() == 1 || typeJson.size() == 2))
            throw new PreconditionException(PreconditionExceptionType.INVALID_CONFIG,
                    "<type> property as array can have either one or two items: " + typeJson.toString());

        // validate that the input columns are present in input schema
        String[] inputColNames = null;
        DataType[] inputColTypes = null;

        if (aggregateJson.has("input") && !aggregateJson.get("input").isNull()) {
            inputColNames = JsonUtils.asArray(aggregateJson, "input");
            inputColTypes = new DataType[inputColNames.length];
            int idx = 0;
            for (String colName : inputColNames) {
                if (!inputSchema.hasIndex(colName))
                    throw new PreconditionException(PreconditionExceptionType.COLUMN_NOT_PRESENT, colName);

                inputColTypes[idx++] = inputSchema.getType(inputSchema.getIndex(colName));
            }//w  ww .  j av  a2s . co  m
        }

        // handle first the special case of array with two items
        if (typeJson.isArray() && typeJson.size() == 2) {
            String[] aggregators = JsonUtils.asArray(typeJson);

            ValueAggregationType outerType = getCubeAggregationType(aggregators[0], true);
            ValueAggregationType innerType = getCubeAggregationType(aggregators[1], true);

            // the "type" of inner aggregate is the type of input column
            ValueAggregator innerAggregator = ValueAggregatorFactory.get(innerType, inputColTypes[0],
                    inputColNames[0]);
            // the "type" of outer aggregate is the output type of inner aggregate
            ValueAggregator outerAggregator = ValueAggregatorFactory.get(outerType,
                    innerAggregator.outputType(), inputColNames[0]);

            DupleCubeAggregator cubeAggregator = new DefaultDupleCubeAggregator(outerAggregator,
                    innerAggregator);

            if (!hasInnerDimensions)
                errorInnerDimensionsNotSpecified(java.util.Arrays.toString(aggregators));

            dupleAggs.add(new DupleCubeAggInfo(cubeAggregator, aggregateJson));
        } else {
            String type = typeJson.isArray() ? typeJson.get(0).getTextValue() : typeJson.getTextValue();

            ValueAggregationType aggType = getCubeAggregationType(type, false);

            // if this is builtin aggregator
            if (aggType != null) {

                ValueAggregator aggregator = ValueAggregatorFactory.get(aggType,
                        inputColTypes == null ? null : inputColTypes[0],
                        inputColNames == null ? null : inputColNames[0]);

                CubeAggregator cubeggregator = new DefaultCubeAggregator(aggregator);

                aggs.add(new CubeAggInfo(cubeggregator, aggregateJson));

            } else if (type.equals("COUNT_DISTINCT")) {
                if (!hasInnerDimensions)
                    errorInnerDimensionsNotSpecified(type);

                DupleCubeAggregator cubeAggregator = new CountDistinctCubeAggregator(inputColNames[0]);

                dupleAggs.add(new DupleCubeAggInfo(cubeAggregator, aggregateJson));
            }
            // this is udaf
            else {
                Object object = null;

                try {
                    Class<?> cls = ClassCache.forName(type);
                    object = instantiateObject(cls, aggregateJson.get("constructorArgs"));

                } catch (ClassNotFoundException e) {
                    throw new PreconditionException(PreconditionExceptionType.CLASS_NOT_FOUND, type);
                } catch (Exception e) {
                    throw new PreconditionException(PreconditionExceptionType.MISC_ERROR,
                            e.getClass().getSimpleName() + " " + e.getMessage() + " for class: " + type);
                }

                if (object instanceof DupleCubeAggregator) {
                    DupleCubeAggregator cubeAggregator = (DupleCubeAggregator) object;

                    if (!hasInnerDimensions)
                        errorInnerDimensionsNotSpecified(type);
                    dupleAggs.add(new DupleCubeAggInfo(cubeAggregator, aggregateJson));

                } else if (object instanceof CubeAggregator) {
                    CubeAggregator cubeAggregator = (CubeAggregator) object;

                    aggs.add(new CubeAggInfo(cubeAggregator, aggregateJson));
                }

                else if (object instanceof EasyCubeAggregator) {
                    EasyCubeAggregatorBridge cubeAggregator = new EasyCubeAggregatorBridge(
                            (EasyCubeAggregator) object);

                    if (!hasInnerDimensions)
                        errorInnerDimensionsNotSpecified(type);

                    dupleAggs.add(new DupleCubeAggInfo(cubeAggregator, aggregateJson));
                } else {
                    String msg = String.format(
                            "%s should implement one of these interfaces: AdditiveCubeAggregate, PartitionedAdditiveAggregate, EasyCubeAggregate",
                            type);
                    throw new PreconditionException(PreconditionExceptionType.MISC_ERROR, msg);
                }
            }
        }
    }
}

From source file:org.apache.accumulo.shell.commands.SetIterCommand.java

private static String setUpOptions(ClassLoader classloader, final ConsoleReader reader, final String className,
        final Map<String, String> options) throws IOException, ShellCommandException {
    String input;// ww  w . jav  a 2s.  c om
    @SuppressWarnings("rawtypes")
    SortedKeyValueIterator untypedInstance;
    @SuppressWarnings("rawtypes")
    Class<? extends SortedKeyValueIterator> clazz;
    try {
        clazz = classloader.loadClass(className).asSubclass(SortedKeyValueIterator.class);
        untypedInstance = clazz.newInstance();
    } catch (ClassNotFoundException e) {
        StringBuilder msg = new StringBuilder("Unable to load ").append(className);
        if (className.indexOf('.') < 0) {
            msg.append("; did you use a fully qualified package name?");
        } else {
            msg.append("; class not found.");
        }
        throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    } catch (InstantiationException e) {
        throw new IllegalArgumentException(e.getMessage());
    } catch (IllegalAccessException e) {
        throw new IllegalArgumentException(e.getMessage());
    } catch (ClassCastException e) {
        StringBuilder msg = new StringBuilder(50);
        msg.append(className).append(" loaded successfully but does not implement SortedKeyValueIterator.");
        msg.append(" This class cannot be used with this command.");
        throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    }

    @SuppressWarnings("unchecked")
    SortedKeyValueIterator<Key, Value> skvi = untypedInstance;
    OptionDescriber iterOptions = null;
    if (OptionDescriber.class.isAssignableFrom(skvi.getClass())) {
        iterOptions = (OptionDescriber) skvi;
    }

    String iteratorName;
    if (null != iterOptions) {
        final IteratorOptions itopts = iterOptions.describeOptions();
        iteratorName = itopts.getName();

        if (iteratorName == null) {
            throw new IllegalArgumentException(
                    className + " described its default distinguishing name as null");
        }
        String shortClassName = className;
        if (className.contains(".")) {
            shortClassName = className.substring(className.lastIndexOf('.') + 1);
        }
        final Map<String, String> localOptions = new HashMap<String, String>();
        do {
            // clean up the overall options that caused things to fail
            for (String key : localOptions.keySet()) {
                options.remove(key);
            }
            localOptions.clear();

            reader.println(itopts.getDescription());

            String prompt;
            if (itopts.getNamedOptions() != null) {
                for (Entry<String, String> e : itopts.getNamedOptions().entrySet()) {
                    prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " parameter " + e.getKey()
                            + ", " + e.getValue() + ": ";
                    reader.flush();
                    input = reader.readLine(prompt);
                    if (input == null) {
                        reader.println();
                        throw new IOException("Input stream closed");
                    }
                    // Places all Parameters and Values into the LocalOptions, even if the value is "".
                    // This allows us to check for "" values when setting the iterators and allows us to remove
                    // the parameter and value from the table property.
                    localOptions.put(e.getKey(), input);
                }
            }

            if (itopts.getUnnamedOptionDescriptions() != null) {
                for (String desc : itopts.getUnnamedOptionDescriptions()) {
                    reader.println(Shell.repeat("-", 10) + "> entering options: " + desc);
                    input = "start";
                    prompt = Shell.repeat("-", 10) + "> set " + shortClassName
                            + " option (<name> <value>, hit enter to skip): ";
                    while (true) {
                        reader.flush();
                        input = reader.readLine(prompt);
                        if (input == null) {
                            reader.println();
                            throw new IOException("Input stream closed");
                        } else {
                            input = new String(input);
                        }

                        if (input.length() == 0)
                            break;

                        String[] sa = input.split(" ", 2);
                        localOptions.put(sa[0], sa[1]);
                    }
                }
            }

            options.putAll(localOptions);
            if (!iterOptions.validateOptions(options))
                reader.println("invalid options for " + clazz.getName());

        } while (!iterOptions.validateOptions(options));
    } else {
        reader.flush();
        reader.println(
                "The iterator class does not implement OptionDescriber. Consider this for better iterator configuration using this setiter command.");
        iteratorName = reader.readLine("Name for iterator (enter to skip): ");
        if (null == iteratorName) {
            reader.println();
            throw new IOException("Input stream closed");
        } else if (StringUtils.isWhitespace(iteratorName)) {
            // Treat whitespace or empty string as no name provided
            iteratorName = null;
        }

        reader.flush();
        reader.println("Optional, configure name-value options for iterator:");
        String prompt = Shell.repeat("-", 10) + "> set option (<name> <value>, hit enter to skip): ";
        final HashMap<String, String> localOptions = new HashMap<String, String>();

        while (true) {
            reader.flush();
            input = reader.readLine(prompt);
            if (input == null) {
                reader.println();
                throw new IOException("Input stream closed");
            } else if (StringUtils.isWhitespace(input)) {
                break;
            }

            String[] sa = input.split(" ", 2);
            localOptions.put(sa[0], sa[1]);
        }

        options.putAll(localOptions);
    }

    return iteratorName;
}

From source file:org.apache.hadoop.hive.ql.plan.PlanUtils.java

/**
  * Generate a table descriptor from a createTableDesc.
  *//*from  w w  w  . ja  v  a2 s .c om*/
public static TableDesc getTableDesc(CreateTableDesc crtTblDesc, String cols, String colTypes) {

    Class<? extends Deserializer> serdeClass = LazySimpleSerDe.class;
    String separatorCode = Integer.toString(Utilities.ctrlaCode);
    String columns = cols;
    String columnTypes = colTypes;
    boolean lastColumnTakesRestOfTheLine = false;
    TableDesc ret;

    try {
        if (crtTblDesc.getSerName() != null) {
            Class c = JavaUtils.loadClass(crtTblDesc.getSerName());
            serdeClass = c;
        }

        if (crtTblDesc.getFieldDelim() != null) {
            separatorCode = crtTblDesc.getFieldDelim();
        }

        ret = getTableDesc(serdeClass, separatorCode, columns, columnTypes, lastColumnTakesRestOfTheLine,
                false);

        // set other table properties
        Properties properties = ret.getProperties();

        if (crtTblDesc.getCollItemDelim() != null) {
            properties.setProperty(serdeConstants.COLLECTION_DELIM, crtTblDesc.getCollItemDelim());
        }

        if (crtTblDesc.getMapKeyDelim() != null) {
            properties.setProperty(serdeConstants.MAPKEY_DELIM, crtTblDesc.getMapKeyDelim());
        }

        if (crtTblDesc.getFieldEscape() != null) {
            properties.setProperty(serdeConstants.ESCAPE_CHAR, crtTblDesc.getFieldEscape());
        }

        if (crtTblDesc.getLineDelim() != null) {
            properties.setProperty(serdeConstants.LINE_DELIM, crtTblDesc.getLineDelim());
        }

        if (crtTblDesc.getNullFormat() != null) {
            properties.setProperty(serdeConstants.SERIALIZATION_NULL_FORMAT, crtTblDesc.getNullFormat());
        }

        if (crtTblDesc.getTableName() != null && crtTblDesc.getDatabaseName() != null) {
            properties.setProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME,
                    crtTblDesc.getTableName());
        }

        if (crtTblDesc.getTblProps() != null) {
            properties.putAll(crtTblDesc.getTblProps());
        }
        if (crtTblDesc.getSerdeProps() != null) {
            properties.putAll(crtTblDesc.getSerdeProps());
        }

        // replace the default input & output file format with those found in
        // crtTblDesc
        Class c1 = JavaUtils.loadClass(crtTblDesc.getInputFormat());
        Class c2 = JavaUtils.loadClass(crtTblDesc.getOutputFormat());
        Class<? extends InputFormat> in_class = c1;
        Class<? extends HiveOutputFormat> out_class = c2;

        ret.setInputFileFormatClass(in_class);
        ret.setOutputFileFormatClass(out_class);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException("Unable to find class in getTableDesc: " + e.getMessage(), e);
    }
    return ret;
}

From source file:com.crosstreelabs.cognitio.common.CommanderClassConverter.java

@Override
public Class convert(String value) {
    if (StringUtils.isBlank(value)) {
        return null;
    }//from  ww w. j a v  a 2 s.  com

    try {
        return Class.forName(value);
    } catch (ClassNotFoundException ex) {
        LOGGER.warn("{}", ex.getMessage());
    }
    return null;
}

From source file:iristk.util.Record.java

private static Record parseJsonObject(JsonObject json) throws JsonToRecordException {
    try {/*from   w w  w.j a  v a  2s  . co  m*/
        Record record;
        if (json.get("class") != null) {
            Constructor<?> constructor = Class.forName(json.get("class").asString()).getDeclaredConstructor();
            constructor.setAccessible(true);
            record = (Record) constructor.newInstance(null);
        } else {
            record = new Record();
        }
        for (String name : json.names()) {
            if (!name.equals("class")) {
                JsonValue jvalue = json.get(name);
                record.put(name, parseJsonValue(jvalue));
            }
        }
        //System.out.println(json + " " + record);
        return record;
    } catch (ClassNotFoundException e) {
        throw new JsonToRecordException("Class not found: " + e.getMessage());
    } catch (InstantiationException e) {
        throw new JsonToRecordException("Could not create: " + e.getMessage());
    } catch (IllegalAccessException e) {
        throw new JsonToRecordException("Could not access: " + e.getMessage());
    } catch (IllegalArgumentException e) {
        throw new JsonToRecordException("Illegal argument: " + e.getMessage());
    } catch (InvocationTargetException e) {
        throw new JsonToRecordException("Invocation problem: " + e.getMessage());
    } catch (NoSuchMethodException e) {
        throw new JsonToRecordException("No such method: " + e.getMessage());
    } catch (SecurityException e) {
        throw new JsonToRecordException("Securiry problem: " + e.getMessage());
    }
}

From source file:org.apache.accumulo.core.util.shell.commands.SetIterCommand.java

private static String setUpOptions(ClassLoader classloader, final ConsoleReader reader, final String className,
        final Map<String, String> options) throws IOException, ShellCommandException {
    String input;/* ww  w.j  a  v  a  2s . com*/
    @SuppressWarnings("rawtypes")
    SortedKeyValueIterator untypedInstance;
    @SuppressWarnings("rawtypes")
    Class<? extends SortedKeyValueIterator> clazz;
    try {
        clazz = classloader.loadClass(className).asSubclass(SortedKeyValueIterator.class);
        untypedInstance = clazz.newInstance();
    } catch (ClassNotFoundException e) {
        StringBuilder msg = new StringBuilder("Unable to load ").append(className);
        if (className.indexOf('.') < 0) {
            msg.append("; did you use a fully qualified package name?");
        } else {
            msg.append("; class not found.");
        }
        throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    } catch (InstantiationException e) {
        throw new IllegalArgumentException(e.getMessage());
    } catch (IllegalAccessException e) {
        throw new IllegalArgumentException(e.getMessage());
    } catch (ClassCastException e) {
        StringBuilder msg = new StringBuilder(50);
        msg.append(className).append(" loaded successfully but does not implement SortedKeyValueIterator.");
        msg.append(" This class cannot be used with this command.");
        throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    }

    @SuppressWarnings("unchecked")
    SortedKeyValueIterator<Key, Value> skvi = (SortedKeyValueIterator<Key, Value>) untypedInstance;
    OptionDescriber iterOptions = null;
    if (OptionDescriber.class.isAssignableFrom(skvi.getClass())) {
        iterOptions = (OptionDescriber) skvi;
    }

    String iteratorName;
    if (null != iterOptions) {
        final IteratorOptions itopts = iterOptions.describeOptions();
        iteratorName = itopts.getName();

        if (iteratorName == null) {
            throw new IllegalArgumentException(
                    className + " described its default distinguishing name as null");
        }
        String shortClassName = className;
        if (className.contains(".")) {
            shortClassName = className.substring(className.lastIndexOf('.') + 1);
        }
        final Map<String, String> localOptions = new HashMap<String, String>();
        do {
            // clean up the overall options that caused things to fail
            for (String key : localOptions.keySet()) {
                options.remove(key);
            }
            localOptions.clear();

            reader.println(itopts.getDescription());

            String prompt;
            if (itopts.getNamedOptions() != null) {
                for (Entry<String, String> e : itopts.getNamedOptions().entrySet()) {
                    prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " parameter " + e.getKey()
                            + ", " + e.getValue() + ": ";
                    reader.flush();
                    input = reader.readLine(prompt);
                    if (input == null) {
                        reader.println();
                        throw new IOException("Input stream closed");
                    }
                    // Places all Parameters and Values into the LocalOptions, even if the value is "".
                    // This allows us to check for "" values when setting the iterators and allows us to remove
                    // the parameter and value from the table property.
                    localOptions.put(e.getKey(), input);
                }
            }

            if (itopts.getUnnamedOptionDescriptions() != null) {
                for (String desc : itopts.getUnnamedOptionDescriptions()) {
                    reader.println(Shell.repeat("-", 10) + "> entering options: " + desc);
                    input = "start";
                    prompt = Shell.repeat("-", 10) + "> set " + shortClassName
                            + " option (<name> <value>, hit enter to skip): ";
                    while (true) {
                        reader.flush();
                        input = reader.readLine(prompt);
                        if (input == null) {
                            reader.println();
                            throw new IOException("Input stream closed");
                        } else {
                            input = new String(input);
                        }

                        if (input.length() == 0)
                            break;

                        String[] sa = input.split(" ", 2);
                        localOptions.put(sa[0], sa[1]);
                    }
                }
            }

            options.putAll(localOptions);
            if (!iterOptions.validateOptions(options))
                reader.println("invalid options for " + clazz.getName());

        } while (!iterOptions.validateOptions(options));
    } else {
        reader.flush();
        reader.println(
                "The iterator class does not implement OptionDescriber. Consider this for better iterator configuration using this setiter command.");
        iteratorName = reader.readLine("Name for iterator (enter to skip): ");
        if (null == iteratorName) {
            reader.println();
            throw new IOException("Input stream closed");
        } else if (StringUtils.isWhitespace(iteratorName)) {
            // Treat whitespace or empty string as no name provided
            iteratorName = null;
        }

        reader.flush();
        reader.println("Optional, configure name-value options for iterator:");
        String prompt = Shell.repeat("-", 10) + "> set option (<name> <value>, hit enter to skip): ";
        final HashMap<String, String> localOptions = new HashMap<String, String>();

        while (true) {
            reader.flush();
            input = reader.readLine(prompt);
            if (input == null) {
                reader.println();
                throw new IOException("Input stream closed");
            } else if (StringUtils.isWhitespace(input)) {
                break;
            }

            String[] sa = input.split(" ", 2);
            localOptions.put(sa[0], sa[1]);
        }

        options.putAll(localOptions);
    }

    return iteratorName;
}

From source file:eu.alpinweiss.filegen.config.FdrOptionHolderImpl.java

@SuppressWarnings("unchecked")
private Class<CommandStep> getClassByClassName(FdrStep fdrStep) {
    try {/* w w w. j  a  v  a  2s .c o m*/
        return (Class<CommandStep>) Class.forName(fdrStep.getClassName());
    } catch (ClassNotFoundException e) {
        LOGGER.error(e.getMessage(), e);
    }
    return null;
}

From source file:jp.primecloud.auto.tool.management.db.DBConnector.java

public DBConnector(String url, String userId, String password) {
    this.url = url;
    this.userId = userId;
    this.password = password;
    try {// www .  j a v  a 2 s.co  m
        //mysql
        String driver = "com.mysql.jdbc.Driver";
        Class.forName(driver);
    } catch (ClassNotFoundException e) {
        log.error(e.getMessage(), e);
    }
}

From source file:ro.fortsoft.pf4j.spring.ExtensionsInjector.java

private void injectExtensions(BeanDefinitionRegistry registry) {
    PluginManager pluginManager = applicationContext.getBean(PluginManager.class);
    List<PluginWrapper> startedPlugins = pluginManager.getStartedPlugins();
    for (PluginWrapper plugin : startedPlugins) {
        log.debug("Registering extensions of the plugin '{}' as beans", plugin.getPluginId());
        Set<String> extensionClassNames = pluginManager.getExtensionClassNames(plugin.getPluginId());
        for (String extensionClassName : extensionClassNames) {
            Class<?> extensionClass = null;
            try {
                log.debug("Register extension '{}' as bean", extensionClassName);
                extensionClass = plugin.getPluginClassLoader().loadClass(extensionClassName);
                BeanDefinition definition = new RootBeanDefinition(extensionClass);
                // optionally configure all bean properties, like scope, prototype/singleton, etc
                registry.registerBeanDefinition(extensionClassName, definition);
            } catch (ClassNotFoundException e) {
                log.error(e.getMessage(), e);
            }//from  www . j a  v a2s.  c o m
        }
    }
}