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:org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration.java

public Class<InputFormat<NullWritable, VertexWritable>> getGraphInputFormat() {
    try {//  w ww . j av a2s. c  o  m
        return (Class) Class.forName(this.getString(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT));
    } catch (final ClassNotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:org.apache.tinkerpop.gremlin.hadoop.structure.HadoopConfiguration.java

public Class<OutputFormat<NullWritable, VertexWritable>> getGraphOutputFormat() {
    try {/*from w  w  w  .  j  a  va 2s . c  o  m*/
        return (Class) Class.forName(this.getString(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT));
    } catch (final ClassNotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:com.tbodt.jswerve.servlet.JSwerveServlet.java

private void spiderWar(ServletContext ctx, String start, Set<Class<?>> classes) {
    for (String path : ctx.getResourcePaths(start))
        if (ctx.getResourcePaths(path) != null && !ctx.getResourcePaths(path).isEmpty())
            spiderWar(ctx, path, classes);
        else if (path.endsWith(".class"))
            try {
                classes.add(ctx.getClassLoader().loadClass(path
                        .substring("/WEB-INF/classes/".length(), path.indexOf(".class")).replace('/', '.')));
            } catch (ClassNotFoundException ex) {
                throw new WTFException("class" + ex.getMessage() + " not found! but I saw it!");
            }/*from   w  w w . j a  va 2 s  .  co m*/
}

From source file:edu.umd.cs.submitServer.servlets.HandleBuildServerLogMessage.java

/**
 * The doPost method of the servlet. <br>
 *
 * This method is called when a form has its tag value method equals to
 * post./*from w ww . j av  a 2s.co m*/
 *
 * @param request
 *            the request send by the client to the server
 * @param response
 *            the response send by the server to the client
 * @throws ServletException
 *             if an error occurred
 * @throws IOException
 *             if an error occurred
 */
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    MultipartRequest multipartRequest = (MultipartRequest) request.getAttribute(MULTIPART_REQUEST);
    FileItem fileItem = null;
    LoggingEvent loggingEvent = null;
    ObjectInputStream in = null;
    try {
        fileItem = multipartRequest.getFileItem();
        byte[] data = fileItem.get();

        in = new ObjectInputStream(new ByteArrayInputStream(data));
        loggingEvent = (LoggingEvent) in.readObject();

        buildServerLogger.callAppenders(loggingEvent);
    } catch (ClassNotFoundException e) {
        throw new ServletException("Cannot find class: " + e.getMessage(), e);
    } finally {
        if (fileItem != null)
            fileItem.delete();
        if (in != null)
            in.close();
    }
}

From source file:org.apache.hive.hcatalog.common.HCatUtil.java

/**
 * Create an instance of a storage handler. If storageHandler == null,
 * then surrrogate StorageHandler is used to encapsulate the InputFormat, OutputFormat and SerDe.
 * This StorageHandler assumes the other supplied storage artifacts are for a file-based storage system.
 * @param conf job's configuration will be used to configure the Configurable StorageHandler
 * @param storageHandler fully qualified class name of the desired StorageHandle instance
 * @param serDe fully qualified class name of the desired SerDe instance
 * @param inputFormat fully qualified class name of the desired InputFormat instance
 * @param outputFormat fully qualified class name of the desired outputFormat instance
 * @return storageHandler instance//  www .j  a  v a 2  s.  com
 * @throws IOException
 */
public static HiveStorageHandler getStorageHandler(Configuration conf, String storageHandler, String serDe,
        String inputFormat, String outputFormat) throws IOException {

    if ((storageHandler == null) || (storageHandler.equals(FosterStorageHandler.class.getName()))) {
        try {
            FosterStorageHandler fosterStorageHandler = new FosterStorageHandler(inputFormat, outputFormat,
                    serDe);
            fosterStorageHandler.setConf(conf);
            return fosterStorageHandler;
        } catch (ClassNotFoundException e) {
            throw new IOException("Failed to load " + "foster storage handler", e);
        }
    }

    try {
        Class<? extends HiveStorageHandler> handlerClass = (Class<? extends HiveStorageHandler>) Class
                .forName(storageHandler, true, Utilities.getSessionSpecifiedClassLoader());
        return (HiveStorageHandler) ReflectionUtils.newInstance(handlerClass, conf);
    } catch (ClassNotFoundException e) {
        throw new IOException("Error in loading storage handler." + e.getMessage(), e);
    }
}

From source file:iddb.core.cache.CacheFactory.java

@SuppressWarnings({ "static-access", "rawtypes" })
private Cache getCacheImpl(String namespace) throws UnavailableCacheException {
    Object obj = null;//from  w ww  .ja  v a 2  s.com
    try {
        Class impl = this.getClass().forName(CACHE_IMPL);
        obj = impl.newInstance();
    } catch (ClassNotFoundException e) {
        log.warn(e.getMessage());
        throw new UnavailableCacheException();
    } catch (SecurityException e) {
        log.error(e.getMessage());
        throw new UnavailableCacheException();
    } catch (IllegalArgumentException e) {
        log.error(e.getMessage());
        throw new UnavailableCacheException();
    } catch (InstantiationException e) {
        log.error(e.getMessage());
        throw new UnavailableCacheException();
    } catch (IllegalAccessException e) {
        log.error(e.getMessage());
        throw new UnavailableCacheException();
    }
    try {
        PropertyUtils.setProperty(obj, "namespace", namespace);
    } catch (IllegalAccessException e) {
        log.error(e.getMessage());
    } catch (InvocationTargetException e) {
        log.error(e.getMessage());
    } catch (NoSuchMethodException e) {
        log.warn(e.getMessage());
    }
    return (Cache) obj;
}

From source file:com.berkgokden.mongodb.MongoMapStore.java

public Object load(Object key) {
    DBObject dbo = new BasicDBObject();
    dbo.put("_id", key);
    DBObject obj = coll.findOne(dbo);/*from  w  w w .  j  a  va2 s.c om*/
    if (obj == null)
        return null;

    try {
        Class clazz = Class.forName(obj.get("_class").toString());
        return converter.toObject(clazz, obj);
    } catch (ClassNotFoundException e) {
        logger.log(Level.WARNING, e.getMessage(), e);
    }
    return null;
}

From source file:com.invariantproperties.sandbox.springentitylistener.listener.ApplicationContext.java

@Bean
public PlatformTransactionManager transactionManager() {
    JpaTransactionManager tm = new JpaTransactionManager();

    try {/*from   w  w  w. j  av  a  2 s.c o  m*/
        tm.setEntityManagerFactory(this.entityManagerFactory().getObject());
    } catch (ClassNotFoundException e) {
        log.info("class not found: " + e.getMessage());
    }

    return tm;
}

From source file:com.ocs.dynamo.ui.auth.DefaultPermissionCheckerImpl.java

@PostConstruct
public void postConstruct() {

    // scan the class path for all classes annotated with @SpringView
    ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
            true);/*  ww w  .j ava 2  s. c  o  m*/
    provider.addIncludeFilter(new AnnotationTypeFilter(SpringView.class));

    Set<BeanDefinition> views = provider.findCandidateComponents(basePackage);
    for (BeanDefinition d : views) {
        try {
            Class<?> clazz = Class.forName(d.getBeanClassName());

            SpringView view = clazz.getAnnotation(SpringView.class);

            // store the permissions both under the bean name and the view
            // name - unfortunately these
            // don't always have to match but there is no way to tell this
            // to the authentication framework!
            Authorized auth = clazz.getAnnotation(Authorized.class);
            if (auth != null && auth.roles().length > 0) {
                int p = d.getBeanClassName().lastIndexOf(".");
                permissions.put(d.getBeanClassName().substring(p + 1), Arrays.asList(auth.roles()));
                editOnly.put(d.getBeanClassName().substring(p + 1), auth.editOnly());

                permissions.put(view.name(), Arrays.asList(auth.roles()));
                editOnly.put(view.name(), auth.editOnly());
            }
        } catch (ClassNotFoundException e) {
            LOG.error(e.getMessage(), e);
        }
    }
}

From source file:com.metaparadigm.jsonrpc.DateSerializer.java

public Object unmarshall(SerializerState state, Class clazz, Object o) throws UnmarshallException {
    JSONObject jso = (JSONObject) o;// ww  w.  java  2s .co m
    long time = 0;
    try {
        time = jso.getLong("time");
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (jso.has("javaClass")) {
        try {
            clazz = Class.forName(jso.getString("javaClass"));
        } catch (ClassNotFoundException cnfe) {
            throw new UnmarshallException(cnfe.getMessage());
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    if (Date.class.equals(clazz)) {
        return new Date(time);
    } else if (Timestamp.class.equals(clazz)) {
        return new Timestamp(time);
    } else if (java.sql.Date.class.equals(clazz)) {
        return new java.sql.Date(time);
    }
    throw new UnmarshallException("invalid class " + clazz);
}