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.mnxfst.stream.pipeline.PipelineRoot.java

/**
 * @see akka.actor.UntypedActor#preStart()
 *///from w  ww .  ja  v a 2 s  .c  om
public void preStart() throws Exception {
    context().system().log().info("init start [pipeline=" + pipelineConfiguration.getPipelineId() + "]");

    boolean failed = false;
    String pipelineId = pipelineConfiguration.getPipelineId();

    PipelineElementReferenceUpdateMessage refUpdateMessage = new PipelineElementReferenceUpdateMessage(
            pipelineId);

    // iterate through pipeline element configurations and instantiate a new node for each
    for (final PipelineElementConfiguration cfg : pipelineConfiguration.getElements()) {

        // extract required values into variables for faster access ... obviously, ehhh ;-)
        String elementId = cfg.getElementId();
        String description = cfg.getDescription();
        String elementClassName = cfg.getElementClass();

        //////////////////////////////////////////////////////////////////////////////////////
        // ensure that the element does not exist
        if (this.pipelineElements.containsKey(elementId)) {
            reportInitError(pipelineId, elementId, elementClassName,
                    PipelineElementSetupFailedMessage.NON_UNIQUE_ELEMENT_ID,
                    "Element id '" + elementId + "' already in use");
            failed = true;
            break;
        }
        // 
        //////////////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////////////////////////////
        // initialize element 
        context().system().log().info("init start [pipeline=" + pipelineId + ", element=" + elementId
                + ", description=" + description + ", class=" + elementClassName + "]");
        try {
            final ActorRef elementRef = context().actorOf(Props.create(Class.forName(elementClassName), cfg),
                    elementId);
            this.pipelineElements.put(elementId, elementRef);
            refUpdateMessage.addElementReference(elementId, elementRef);

            if (this.initialMessageReceiverRef == null
                    && StringUtils.endsWithIgnoreCase(elementId, pipelineConfiguration.getInitialReceiverId()))
                this.initialMessageReceiverRef = elementRef;
        } catch (ClassNotFoundException e) {
            reportInitError(pipelineId, elementId, elementClassName,
                    PipelineElementSetupFailedMessage.CLASS_NOT_FOUND, "Class not found");
            failed = true;
            break;
        } catch (Exception e) {
            reportInitError(pipelineId, elementId, elementClassName, PipelineElementSetupFailedMessage.GENERAL,
                    e.getMessage());
            failed = true;
            break;
        }
        context().system().log().info("init done  [pipeline=" + pipelineId + ", element=" + elementId
                + ", description=" + description + ", class=" + elementClassName + "]");
    }

    if (this.initialMessageReceiverRef == null) {
        reportInitError(pipelineId, pipelineConfiguration.getInitialReceiverId(), "null",
                PipelineElementSetupFailedMessage.INITIAL_MESSAGE_RECEIVER_NOT_FOUND,
                "Referenced initial message receiver not found");
        failed = true;
    }

    if (failed)
        context().system().log().info("init failed [pipeline=" + pipelineId + "]");
    else {
        context().system().log().info(
                "init done  [pipeline=" + pipelineId + ", elementCount=" + this.pipelineElements.size() + "]");
        context().parent().tell(new PipelineRootInitializedMessage(pipelineId), getSelf());

        // notify all children about each other
        for (final ActorRef pipelineElementRef : this.pipelineElements.values()) {
            pipelineElementRef.tell(refUpdateMessage, getSelf());
        }
    }
}

From source file:org.apache.hadoop.hive.metastore.Warehouse.java

private MetaStoreFS getMetaStoreFsHandler(Configuration conf) throws MetaException {
    String handlerClassStr = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_METASTORE_FS_HANDLER_CLS);
    try {//from   w ww  .j  a  v a2  s. c  o m
        Class<? extends MetaStoreFS> handlerClass = (Class<? extends MetaStoreFS>) Class
                .forName(handlerClassStr, true, JavaUtils.getClassLoader());
        MetaStoreFS handler = ReflectionUtils.newInstance(handlerClass, conf);
        return handler;
    } catch (ClassNotFoundException e) {
        throw new MetaException("Error in loading MetaStoreFS handler." + e.getMessage());
    }
}

From source file:com.mnxfst.testing.server.PTestServerChannelUpstreamHandler.java

/**
 * Initializes the pipeline factory instance
 * @param hostname// w  ww  .  j ava2s .co  m
 * @param port
 * @param socketThreadPoolSize
 */
public PTestServerChannelUpstreamHandler(PTestServerConfiguration serverContextSettings)
        throws ServerConfigurationFailedException {

    // validate provided setting information for valid data
    if (serverContextSettings == null || serverContextSettings.getContextHandlerSettings() == null
            || serverContextSettings.getContextHandlerSettings().isEmpty())
        throw new ServerConfigurationFailedException("No valid context handler settings found");

    if (serverContextSettings.getHostname() == null || serverContextSettings.getHostname().trim().isEmpty())
        throw new ServerConfigurationFailedException("No valid hostname found");
    if (serverContextSettings.getPort() < 0)
        throw new ServerConfigurationFailedException("No valid port found");
    if (serverContextSettings.getSocketPoolSize() < 1)
        throw new ServerConfigurationFailedException("No valid socket thread pool size found");

    this.serverContextSettings = serverContextSettings;

    // configure the context specifc request handlers
    synchronized (contextRequestHandlers) {

        // build log information
        StringBuffer logStr = new StringBuffer();

        // iterate through context path names          
        for (Iterator<String> ctxPathNameIterator = serverContextSettings.getContextHandlerSettings().keySet()
                .iterator(); ctxPathNameIterator.hasNext();) {

            // get context path and set of key/value pairs containing the context specific settings
            String contextPath = ctxPathNameIterator.next();
            Set<NameValuePair> ctxPathSettings = serverContextSettings.getContextHandlerSettings(contextPath);

            // lookup the context handler class
            String contextHandlerClassName = null;
            for (NameValuePair nvp : ctxPathSettings) {
                if (nvp != null && nvp.getName() != null
                        && nvp.getName().equalsIgnoreCase(CONTEXT_HANDLER_CLASS_NAME_PROPERTY_KEY)
                        && nvp.getValue() != null && !nvp.getValue().trim().isEmpty()) {
                    contextHandlerClassName = nvp.getValue().trim();
                    break;
                }
            }
            if (contextHandlerClassName == null || contextHandlerClassName.trim().isEmpty())
                throw new ServerConfigurationFailedException(
                        "No handler class found for context '" + contextPath + "'");

            if (logger.isDebugEnabled())
                logger.debug("Attempting to instantiate a handler for context '" + contextPath + "': "
                        + contextHandlerClassName);

            // attempt to instantiate and initialize configured context handler
            try {
                @SuppressWarnings("unchecked")
                Class<? extends PTestServerContextRequestHandler> contextHandlerClazz = (Class<? extends PTestServerContextRequestHandler>) Class
                        .forName(contextHandlerClassName);
                PTestServerContextRequestHandler contextHandler = contextHandlerClazz.newInstance();
                contextHandler.initialize(serverContextSettings);
                contextRequestHandlers.put(contextPath, contextHandler);
            } catch (ClassNotFoundException e) {
                throw new ServerConfigurationFailedException(
                        "Context handler class '" + contextHandlerClassName + "' not found");
            } catch (InstantiationException e) {
                throw new ServerConfigurationFailedException("Context handler class '" + contextHandlerClassName
                        + "' could not be instantiated. Error: " + e.getMessage());
            } catch (IllegalAccessException e) {
                throw new ServerConfigurationFailedException("Context handler class '" + contextHandlerClassName
                        + "' could not be accessed. Error: " + e.getMessage());
            } catch (ContextInitializationFailedException e) {
                throw new ServerConfigurationFailedException("Failed to initialize handler class '"
                        + contextHandlerClassName + "' to be used for context '" + contextPath + "'");
            } catch (ClassCastException e) {
                throw new ServerConfigurationFailedException("Provided context handler class '"
                        + contextHandlerClassName + "' does not implement required interface '"
                        + PTestServerContextRequestHandler.class.getName() + "'");
            }

            // create log output
            logStr.append("(").append(contextPath).append(", ").append(contextHandlerClassName).append(")");
            if (ctxPathNameIterator.hasNext())
                logStr.append(", ");

        }

        logger.info("consumer[host=" + serverContextSettings.getHostname() + ", port="
                + serverContextSettings.getPort() + ", socketThreadPoolSize="
                + serverContextSettings.getSocketPoolSize() + ", consumers=[" + logStr.toString() + "]]");
    }
}

From source file:org.apache.james.mailrepository.jcr.JCRMailRepository.java

/**
 * Writes the mail attributes from the <code>jamesattr:*</code> property.
 * //from  w w  w  . j a v a 2s .com
 * @param node
 *            mail node
 * @param mail
 *            mail message
 * @throws RepositoryException
 *             if a repository error occurs
 * @throws IOException
 *             if an IO error occurs
 */
private void getAttributes(Node node, Mail mail) throws RepositoryException, IOException {
    PropertyIterator iterator = node.getProperties("jamesattr:*");
    while (iterator.hasNext()) {
        Property property = iterator.nextProperty();
        String name = Text.unescapeIllegalJcrChars(property.getName().substring("jamesattr:".length()));
        if (property.getType() == PropertyType.BINARY) {
            @SuppressWarnings("deprecation")
            InputStream input = property.getStream();
            try {
                ObjectInputStream stream = new ObjectInputStream(input);
                mail.setAttribute(name, (Serializable) stream.readObject());
            } catch (ClassNotFoundException e) {
                throw new IOException(e.getMessage());
            } finally {
                input.close();
            }
        } else {
            mail.setAttribute(name, property.getString());
        }
    }
}

From source file:org.apache.gora.cassandra.serializers.AvroSerializer.java

private Object getValue(AbstractGettableData row, DataType columnType, String columnName, Schema schema) {
    Object paramValue;//from   w w  w .j a v a  2  s  .  c  o m
    String dataType;
    switch (columnType.getName()) {
    case ASCII:
        paramValue = row.getString(columnName);
        break;
    case BIGINT:
        paramValue = row.isNull(columnName) ? null : row.getLong(columnName);
        break;
    case BLOB:
        paramValue = row.isNull(columnName) ? null : row.getBytes(columnName);
        break;
    case BOOLEAN:
        paramValue = row.isNull(columnName) ? null : row.getBool(columnName);
        break;
    case COUNTER:
        paramValue = row.isNull(columnName) ? null : row.getLong(columnName);
        break;
    case DECIMAL:
        paramValue = row.isNull(columnName) ? null : row.getDecimal(columnName);
        break;
    case DOUBLE:
        paramValue = row.isNull(columnName) ? null : row.getDouble(columnName);
        break;
    case FLOAT:
        paramValue = row.isNull(columnName) ? null : row.getFloat(columnName);
        break;
    case INET:
        paramValue = row.isNull(columnName) ? null : row.getInet(columnName).toString();
        break;
    case INT:
        paramValue = row.isNull(columnName) ? null : row.getInt(columnName);
        break;
    case TEXT:
        paramValue = row.getString(columnName);
        break;
    case TIMESTAMP:
        paramValue = row.isNull(columnName) ? null : row.getDate(columnName);
        break;
    case UUID:
        paramValue = row.isNull(columnName) ? null : row.getUUID(columnName);
        break;
    case VARCHAR:
        paramValue = row.getString(columnName);
        break;
    case VARINT:
        paramValue = row.isNull(columnName) ? null : row.getVarint(columnName);
        break;
    case TIMEUUID:
        paramValue = row.isNull(columnName) ? null : row.getUUID(columnName);
        break;
    case LIST:
        dataType = columnType.getTypeArguments().get(0).toString();
        paramValue = row.isNull(columnName) ? null
                : row.getList(columnName, AvroCassandraUtils.getRelevantClassForCassandraDataType(dataType));
        break;
    case SET:
        dataType = columnType.getTypeArguments().get(0).toString();
        paramValue = row.isNull(columnName) ? null
                : row.getList(columnName, AvroCassandraUtils.getRelevantClassForCassandraDataType(dataType));
        break;
    case MAP:
        dataType = columnType.getTypeArguments().get(1).toString();
        // Avro supports only String for keys
        paramValue = row.isNull(columnName) ? null
                : row.getMap(columnName, String.class,
                        AvroCassandraUtils.getRelevantClassForCassandraDataType(dataType));
        break;
    case UDT:
        paramValue = row.isNull(columnName) ? null : row.getUDTValue(columnName);
        if (paramValue != null) {
            try {
                PersistentBase udtObject = (PersistentBase) SpecificData
                        .newInstance(Class.forName(schema.getFullName()), schema);
                for (Schema.Field f : udtObject.getSchema().getFields()) {
                    DataType dType = ((UDTValue) paramValue).getType().getFieldType(f.name());
                    Object fieldValue = getValue((UDTValue) paramValue, dType, f.name(), f.schema());
                    udtObject.put(f.pos(), fieldValue);
                }
                paramValue = udtObject;
            } catch (ClassNotFoundException e) {
                throw new RuntimeException("Error occurred while populating data to " + schema.getFullName()
                        + " : " + e.getMessage());
            }
        }
        break;
    case TUPLE:
        paramValue = row.isNull(columnName) ? null : row.getTupleValue(columnName).toString();
        break;
    case CUSTOM:
        paramValue = row.isNull(columnName) ? null : row.getBytes(columnName);
        break;
    default:
        paramValue = row.getString(columnName);
        break;
    }
    return paramValue;
}

From source file:com.taobao.ad.easyschedule.action.job.AddJobAction.java

/**
 * //* w  w  w.  ja v  a 2 s  .  co  m*/
 * 
 * @return
 * @throws Exception
 */
@ActionSecurity(module = 2)
public String addJob() throws Exception {

    if (!checkIsInGroup(jobDetail.getGroup())) {
        return ERROR;
    }

    try {
        jobDetail.setJobClass(Class.forName(className));
        for (int i = 0; i < parameterNames.length; i++) {
            if (parameterNames[i].trim().length() > 0 && parameterValues[i].trim().length() > 0) {
                jobDetail.getJobDataMap().put(parameterNames[i].trim(), parameterValues[i].trim());
            }
        }
        // ???
        if (parameterInputOutPutT != null && parameterInputOutPutT.length > 0
                && parameterInputOutPutType != null && parameterInputOutPutType.length > 0
                && parameterInputOutPutValue != null && parameterInputOutPutValue.length > 0) {
            JSONArray array = new JSONArray();
            for (int i = 0; i < parameterInputOutPutT.length; i++) {
                JSONObject result = new JSONObject();
                int type = Integer.parseInt(parameterInputOutPutType[i]);
                if (parameterInputOutPutValue[i] != null && !parameterInputOutPutValue[i].isEmpty()) {
                    switch (type) {
                    case Constants.STOREDPROCEDUREJOB_VARCHAR:
                    case Constants.STOREDPROCEDUREJOB_NUMBER:
                        result.put("value", parameterInputOutPutValue[i]);
                        break;
                    case Constants.STOREDPROCEDUREJOB_DATE:
                        result.put("value", parameterInputOutPutValue[i]);
                        break;
                    }
                }
                result.put("t", parameterInputOutPutT[i]);
                result.put("type", type);
                array.put(result);
            }
            // ??
            jobDetail.getJobDataMap().put("synchronous", "true");
            jobDetail.getJobDataMap().put("parameter", array.toString());
        }
        jobDetail.getJobDataMap().put("version", Constants.ES_CURRENT_VERSION);

        if (Constants.TRIGGERTYPE_SIMPLE.equals(triggerType)) {
            // ??
            SimpleTrigger trigger = new SimpleTrigger(jobDetail.getName(), jobDetail.getGroup(), repeatCount,
                    repeatInterval);
            trigger.setPriority(priority);
            trigger.setDescription(description);
            if (startTimeAsDate != null)
                trigger.setStartTime(startTimeAsDate);
            if (stopTimeAsDate != null)
                trigger.setEndTime(stopTimeAsDate);
            if (action == Constants.JOB_ACTION_ADD) {
                easyscheduler.scheduleJob(jobDetail, trigger);
            } else if (action == Constants.JOB_ACTION_MOD) {
                easyscheduler.deleteJob(jobDetail.getName(), jobDetail.getGroup());
                easyscheduler.scheduleJob(jobDetail, trigger);
            } else {
                return ERROR;
            }

        } else {
            // Cron?
            CronTrigger trigger = new CronTrigger(jobDetail.getName(), jobDetail.getGroup(),
                    jobDetail.getName(), jobDetail.getGroup(), cronExpression);
            trigger.setPriority(priority);
            trigger.setDescription(this.getDescription());
            if (startTimeAsDate != null)
                trigger.setStartTime(startTimeAsDate);
            if (stopTimeAsDate != null)
                trigger.setEndTime(stopTimeAsDate);
            if (action == Constants.JOB_ACTION_ADD) {
                easyscheduler.scheduleJob(jobDetail, trigger);
            } else if (action == Constants.JOB_ACTION_MOD) {
                easyscheduler.addJob(jobDetail, true);
                easyscheduler.rescheduleJob(jobDetail.getName(), jobDetail.getGroup(), trigger);
            } else {
                return ERROR;
            }
        }
        createJobDetail(jobDetail.getJobDataMap(), action, className);

    } catch (ClassNotFoundException e) {
        logger.error(e.getMessage(), e);
        addActionError(e.getMessage());
        return ERROR;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        addActionError(e.getMessage());
        return ERROR;
    }
    return SUCCESS;
}

From source file:com.snaplogic.snaps.firstdata.Create.java

private Class<?> getClassType(String path) {
    Class<?> clasz = null;//from w ww  . j  av a2s.  c om
    try {
        clasz = Class.forName(path);
        return clasz;
    } catch (ClassNotFoundException ex) {
        log.error(ex.getMessage(), ex);
        throw new SnapDataException(ex, ex.getMessage());
    }
}

From source file:com.snaplogic.snaps.firstdata.Create.java

@Override
public void defineInputSchema(SchemaProvider provider) {
    Class<?> classType = null;
    try {// w w w.j  a v  a  2s.c  o  m
        classType = Class.forName(getGMFReqClassType());
    } catch (ClassNotFoundException e) {
        log.error(e.getMessage(), e);
        throw new ExecutionException(e.getMessage());
    }
    for (String viewName : provider.getRegisteredViewNames()) {
        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:edu.ku.brc.af.auth.specify.SpecifySecurityMgr.java

@Override
public boolean authenticateDB(final String user, final String pass, final String driverClass, final String url,
        final String dbUserName, final String dbPwd) throws Exception {
    Connection conn = null;/*from   w w  w.j av  a  2 s .co  m*/
    Statement stmt = null;
    boolean passwordMatch = false;

    try {
        Class.forName(driverClass);

        conn = DriverManager.getConnection(url, dbUserName, dbPwd);

        String query = "SELECT * FROM specifyuser where name='" + user + "'"; //$NON-NLS-1$ //$NON-NLS-2$
        stmt = conn.createStatement();
        ResultSet result = stmt.executeQuery(query);
        String dbPassword = null;

        while (result.next()) {
            if (!result.isFirst()) {
                throw new LoginException("authenticateDB - Ambiguous user (located more than once): " + user); //$NON-NLS-1$
            }
            dbPassword = result.getString(result.findColumn("Password")); //$NON-NLS-1$

            if (StringUtils.isNotEmpty(dbPassword) && StringUtils.isAlphanumeric(dbPassword)
                    && UIHelper.isAllCaps(dbPassword) && dbPassword.length() > 20) {
                dbPassword = Encryption.decrypt(dbPassword, pass);
            }
            break;
        }

        /*if (dbPassword == null)
        {
        throw new LoginException("authenticateDB - Password for User " + user + " undefined."); //$NON-NLS-1$ //$NON-NLS-2$
        }*/
        if (pass != null && dbPassword != null && pass.equals(dbPassword)) {
            passwordMatch = true;
        }

        // else: passwords do NOT match, user will not be authenticated
    } catch (java.lang.ClassNotFoundException e) {
        e.printStackTrace();
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifySecurityMgr.class, e);
        log.error("authenticateDB - Could not connect to database, driverclass - ClassNotFoundException: "); //$NON-NLS-1$
        log.error(e.getMessage());
        throw new LoginException("authenticateDB -  Database driver class not found: " + driverClass); //$NON-NLS-1$
    } catch (SQLException ex) {
        if (debug)
            log.error("authenticateDB - SQLException: " + ex.toString()); //$NON-NLS-1$
        if (debug)
            log.error("authenticateDB - " + ex.getMessage()); //$NON-NLS-1$
        throw new LoginException("authenticateDB - SQLException: " + ex.getMessage()); //$NON-NLS-1$
    } finally {
        try {
            if (conn != null)
                conn.close();
            if (stmt != null)
                stmt.close();
        } catch (SQLException e) {
            edu.ku.brc.af.core.UsageTracker.incrSQLUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpecifySecurityMgr.class, e);
            log.error("Exception caught: " + e.toString()); //$NON-NLS-1$
            e.printStackTrace();
        }
    }
    return passwordMatch;
}

From source file:com.flexive.war.filter.FxFilter.java

/**
 * Dynamic registration of a Java class in the JSON/RPC bridge. If the class could not be loaded,
 * a log message will be written but no exception will be thrown.
 *
 * @param bridge    the JSON/RPC bridge//from   w  ww  .  ja v  a  2s.  c  o  m
 * @param name      the name under which the bean will be addressed by JSON/RPC
 * @param className the fully qualified class name
 */
protected void registerJsonRpcObject(JSONRPCBridge bridge, String name, String className) {
    try {
        bridge.registerObject(name, Class.forName(className).newInstance());
    } catch (ClassNotFoundException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Skipping JSON/RPC provider " + name + "(" + className
                    + ") because it was not found in the classpath.");
        }
    } catch (IllegalAccessException e) {
        LOG.warn("Failed to create JSF JSON/RPC objects: " + e.getMessage(), e);
    } catch (InstantiationException e) {
        LOG.warn("Failed to create JSF JSON/RPC objects: " + e.getMessage(), e);
    }
}