Example usage for java.lang NoClassDefFoundError getMessage

List of usage examples for java.lang NoClassDefFoundError getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.manydesigns.portofino.modules.MailModule.java

@Override
public void start() {
    //Quartz integration (optional)
    try {//from  w  ww  .ja  v  a  2  s.  co m
        //In classe separata per permettere al modulo di essere caricato anche in assenza di Quartz a runtime
        MailScheduler.setupMailScheduler(mailQueueSetup);
    } catch (NoClassDefFoundError e) {
        logger.debug(e.getMessage(), e);
        logger.info("Quartz is not available, mail scheduler not started");
    }
    status = ModuleStatus.STARTED;
}

From source file:com.monami_ya.mwe2.launch.runtime.AWorkflowLauncher.java

@Override
public void run(String[] args) {
    Options options = getOptions();/*from   ww  w.java 2 s.com*/
    final CommandLineParser parser = new PosixParser();
    CommandLine line = null;
    try {
        line = parser.parse(options, args);
        if (line.getArgs().length == 0)
            throw new ParseException("No module name specified.");
        if (line.getArgs().length > 1)
            throw new ParseException("Only one module name expected. But " + line.getArgs().length
                    + " were passed (" + line.getArgList() + ")");

        String moduleName = line.getArgs()[0];
        Map<String, String> params = new HashMap<String, String>();
        String[] optionValues = line.getOptionValues(PARAM);
        if (optionValues != null) {
            for (String string : optionValues) {
                int index = string.indexOf('=');
                if (index == -1) {
                    throw new ParseException(
                            "Incorrect parameter syntax '" + string + "'. It should be 'name=value'");
                }
                String name = string.substring(0, index);
                String value = string.substring(index + 1);
                if (params.put(name, value) != null) {
                    throw new ParseException("Duplicate parameter '" + name + "'.");
                }
            }
        }
        // check OperationCanceledException is accessible
        OperationCanceledException.class.getName();

        Injector injector = new AWorkflowStandaloneSetup().createInjectorAndDoEMFRegistration();
        Mwe2Runner mweRunner = injector.getInstance(Mwe2Runner.class);
        if (moduleName.contains("/")) {
            mweRunner.run(URI.createURI(moduleName), params);
        } else {
            mweRunner.run(moduleName, params);
        }
    } catch (NoClassDefFoundError e) {
        if ("org/eclipse/core/runtime/OperationCanceledException".equals(e.getMessage())) {
            System.err.println("Could not load class: org.eclipse.core.runtime.OperationCanceledException");
            System.err.println("Add org.eclipse.equinox.common to the class path.");
        } else {
            throw e;
        }
    } catch (final ParseException exp) {
        final HelpFormatter formatter = new HelpFormatter();
        System.err.println("Parsing arguments failed.  Reason: " + exp.getMessage());
        formatter.printHelp("java " + AWorkflowLauncher.class.getName() + " some.mwe2.Module [options]\n",
                options);
        return;
    }
}

From source file:org.apache.cactus.internal.server.AbstractWebTestController.java

/**
 * Handles the incoming request by extracting the requested service and
 * calling the correct method on a <code>WebTestCaller</code>.
 *
 * @param theObjects the implicit objects (they are different for the
 *                   different redirectors)
 * @exception ServletException if an error occurs when servicing the
 *            request//  w ww  . j  a  va  2s. c o  m
 */
public void handleRequest(ImplicitObjects theObjects) throws ServletException {
    WebImplicitObjects webImplicitObjects = (WebImplicitObjects) theObjects;

    // If the Cactus user has forgotten to put a needed jar on the server
    // classpath (i.e. in WEB-INF/lib), then the servlet engine Webapp
    // class loader will throw a NoClassDefFoundError exception. As this
    // method is the entry point of the webapp, we'll catch all
    // NoClassDefFoundError exceptions and report a nice error message
    // for the user so that he knows he has forgotten to put a jar in the
    // classpath. If we don't do this, the error will be trapped by the
    // container and may not result in an ... err ... understandable error
    // message (like in Tomcat) ...
    try {
        String serviceName = getServiceName(webImplicitObjects.getHttpServletRequest());

        AbstractWebTestCaller caller = getTestCaller(webImplicitObjects);

        // TODO: will need a factory here real soon...

        ServiceEnumeration service = ServiceEnumeration.valueOf(serviceName);

        // Is it the call test method service ?
        if (service == ServiceEnumeration.CALL_TEST_SERVICE) {
            caller.doTest();
        }
        // Is it the get test results service ?
        else if (service == ServiceEnumeration.GET_RESULTS_SERVICE) {
            caller.doGetResults();
        }
        // Is it the test connection service ?
        // This service is only used to verify that connection between
        // client and server is working fine
        else if (service == ServiceEnumeration.RUN_TEST_SERVICE) {
            caller.doRunTest();
        }
        // Is it the service to create an HTTP session?
        else if (service == ServiceEnumeration.CREATE_SESSION_SERVICE) {
            caller.doCreateSession();
        } else if (service == ServiceEnumeration.GET_VERSION_SERVICE) {
            caller.doGetVersion();
        } else {
            String message = "Unknown service [" + serviceName + "] in HTTP request.";

            LOGGER.error(message);
            throw new ServletException(message);
        }
    } catch (NoClassDefFoundError e) {
        // try to display messages as descriptive as possible !
        if (e.getMessage().startsWith("junit/framework")) {
            String message = "You must put the JUnit jar in "
                    + "your server classpath (in WEB-INF/lib for example)";

            LOGGER.error(message, e);
            throw new ServletException(message, e);
        } else {
            String message = "You are missing a jar in your " + "classpath (class [" + e.getMessage()
                    + "] could not " + "be found";

            LOGGER.error(message, e);
            throw new ServletException(message, e);
        }
    }
}

From source file:org.apache.cactus.internal.server.MessageDrivenBeanTestController.java

/**
 * This method is supposed to handle the request from the Redirector.
 * /*from  w w w .  ja v a2 s.  co  m*/
 * @param theObjects for the request
 * @throws JMSException in case an error occurs
 */
public void handleRequest(ImplicitObjects theObjects) throws JMSException {
    MessageDrivenBeanImplicitObjects mdbImplicitObjects = (MessageDrivenBeanImplicitObjects) theObjects;

    // If the Cactus user has forgotten to put a needed jar on the server
    // classpath (i.e. in WEB-INF/lib), then the servlet engine Webapp
    // class loader will throw a NoClassDefFoundError exception. As this
    // method is the entry point of the webapp, we'll catch all
    // NoClassDefFoundError exceptions and report a nice error message
    // for the user so that he knows he has forgotten to put a jar in the
    // classpath. If we don't do this, the error will be trapped by the
    // container and may not result in an ... err ... understandable error
    // message (like in Tomcat) ...
    try {
        String serviceName = getServiceName(mdbImplicitObjects.getMessage());

        MessageDrivenBeanTestCaller caller = getTestCaller(mdbImplicitObjects);

        // TODO: will need a factory here real soon...

        ServiceEnumeration service = ServiceEnumeration.valueOf(serviceName);

        // Is it the call test method service ?
        if (service == ServiceEnumeration.CALL_TEST_SERVICE) {
            caller.doTest();
        }
        // Is it the get test results service ?
        else if (service == ServiceEnumeration.GET_RESULTS_SERVICE) {
            caller.doGetResults();
        }
        // Is it the test connection service ?
        // This service is only used to verify that connection between
        // client and server is working fine
        else if (service == ServiceEnumeration.RUN_TEST_SERVICE) {
            caller.doRunTest();
        }
        // Is it the service to create an HTTP session?
        else if (service == ServiceEnumeration.CREATE_SESSION_SERVICE) {
            caller.doCreateSession();
        } else if (service == ServiceEnumeration.GET_VERSION_SERVICE) {
            caller.doGetVersion();
        } else {
            String message = "Unknown service [" + serviceName + "] in HTTP request.";

            LOGGER.error(message);
            throw new JMSException(message);
        }
    } catch (NoClassDefFoundError e) {
        // try to display messages as descriptive as possible !
        if (e.getMessage().startsWith("junit/framework")) {
            String message = "You must put the JUnit jar in "
                    + "your server classpath (in WEB-INF/lib for example)";

            LOGGER.error(message, e);
            throw new JMSException(message);
        } else {
            String message = "You are missing a jar in your " + "classpath (class [" + e.getMessage()
                    + "] could not " + "be found";

            LOGGER.error(message, e);
            throw new JMSException(message);
        }
    }
}

From source file:lodsve.core.condition.SpringBootCondition.java

@Override
public final boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
    String classOrMethodName = getClassOrMethodName(metadata);
    try {//w  ww  . ja  va2 s  . c  o m
        ConditionOutcome outcome = getMatchOutcome(context, metadata);
        logOutcome(classOrMethodName, outcome);
        recordEvaluation(context, classOrMethodName, outcome);
        return outcome.isMatch();
    } catch (NoClassDefFoundError ex) {
        throw new IllegalStateException("Could not evaluate condition on " + classOrMethodName + " due to "
                + ex.getMessage() + " not " + "found. Make sure your own configuration does not rely on "
                + "that class. This can also happen if you are "
                + "@ComponentScanning a springframework package (e.g. if you "
                + "put a @ComponentScan in the default package by mistake)", ex);
    } catch (RuntimeException ex) {
        throw new IllegalStateException("Error processing condition on " + getName(metadata), ex);
    }
}

From source file:com.curl.orb.generator.ClassPathLoader.java

private void searchPath(File dir, int rootPathLength) throws GeneratorException {
    File[] files = dir.listFiles();
    for (File file : files) {
        if (file.isDirectory()) {
            searchPath(file, rootPathLength);
        } else if (file.isFile()) {
            String filename = null;
            try {
                filename = file.getCanonicalPath();
                if (filename.endsWith(".jar")) {
                    if (!(filename.endsWith("curl-orb-server.jar") || filename.endsWith("curl-serializer.jar")))
                        classProperties.addAll(JarFileLoader.loadJarFileProperty(filename));
                } else if (filename.endsWith(".class")) {
                    // Windows and UNIX
                    String className = filename.substring(rootPathLength + 1, filename.length() - 6)
                            .replace('\\', '.').replace('/', '.');
                    ClassProperty classProperty = new ClassProperty(className);
                    if (classProperty.isPublic())
                        classProperties.add(classProperty); // if not public, it will be skipped.
                }/*  ww  w.j  a va 2  s  .  c o  m*/
            } catch (IOException e) {
                throw new GeneratorException(e);
            }
            /* skiped Exception */
            catch (NoClassDefFoundError skip) {
                log.warn(
                        filename + " was skiped due to " + skip.getClass().getName() + " " + skip.getMessage());
            } catch (UnsatisfiedLinkError skip) {
                log.warn(
                        filename + " was skiped due to " + skip.getClass().getName() + " " + skip.getMessage());
            }
            // TODO: all exceptions should be skipped?
            catch (Throwable skip) {
                log.error(
                        filename + " was skiped due to " + skip.getClass().getName() + " " + skip.getMessage());
            }
        }
    }
}

From source file:com.asynhkm.productchecker.Checker.CheckerTask.java

@Override
protected DataProductVersion doInBackground(Void... c) {
    DataProductVersion h;/*from w w  w  .ja  v a2  s  .c  o m*/
    try {
        RequestBody body = RequestBody.create(JSON, consolidate());
        Request request = new Request.Builder().url(request_url).post(body).build();
        Response response = client.newCall(request).execute();
        String res = response.body().string();
        h = return_result(res);
    } catch (NoClassDefFoundError e) {

        h = new DataProductVersion();
        h.setRR(new ReturnResult(e.getMessage()));

    } catch (IOException e) {

        Log.d("work ERROR", e.getMessage());
        h = new DataProductVersion();
        h.setRR(new ReturnResult(e.getMessage()));

    } catch (Exception e) {

        Log.d("work ERROR", e.getMessage());
        h = new DataProductVersion();
        h.setRR(new ReturnResult(e.getMessage()));

    }
    return h;
}

From source file:org.programmatori.domotica.own.server.engine.EngineManagerImpl.java

public EngineManagerImpl() {
    log.trace("Start Create Istance");
    setName("SCS Engine");
    //setDaemon(true);
    Config.getInstance().addThread(this);

    //Load Engine
    try {// ww w.ja  v  a 2s.  com
        String busName = Config.getInstance().getBus();
        log.debug("Engine Class Name: " + busName);

        Class<?> c = ClassLoader.getSystemClassLoader().loadClass(busName);
        engine = (Engine) c.newInstance();
        //engine.addEventListener(this);
    } catch (NoClassDefFoundError e) {
        if (e.getMessage().indexOf("SerialPortEventListener") > -1) {
            log.error("You must install RXTX library (http://rxtx.qbang.org/)");
        } else {
            throw e;
        }
        System.exit(-1);
    } catch (Exception e) {
        log.error(LogUtility.getErrorTrace(e));
        System.exit(-1);
    }

    msgSended = new ListenerPriorityBlockingQueue<Command>();
    msgSended.addListener(this);
    changeQueue = false;

    //monitors = new ArrayList<Monitor>();
    sender = new MsgSender(engine, msgSended);
    sender.start();
    receiver = new MsgReceiver(engine, msgSended);
    msgSended.addListener(receiver);
    receiver.start();
    sendTimeout = Config.getInstance().getSendTimeout();

    // load Module
    loadPlugIn();

    log.trace("End Create Istance");
}

From source file:net.camelpe.extension.camel.typeconverter.CdiTypeConverterBuilder.java

private void buildTypeConvertersFromClassHierarchy(final Class<?> type,
        final Set<TypeConverterHolder> alreadyBuiltTypeConverters) {
    try {/*  ww w.j  ava  2  s .c o  m*/
        final Method[] methods = type.getDeclaredMethods();
        for (final Method method : methods) {
            // this may be prone to ClassLoader or packaging problems when
            // the same class is defined
            // in two different jars (as is the case sometimes with specs).
            if (ObjectHelper.hasAnnotation(method, Converter.class, true)) {
                alreadyBuiltTypeConverters.add(buildTypeConverterFromConverterAnnotatedClass(type, method));
            } else if (ObjectHelper.hasAnnotation(method, FallbackConverter.class, true)) {
                alreadyBuiltTypeConverters
                        .add(buildFallbackTypeConverterFromFallbackConverterAnnotatedClass(type, method));
            }
        }

        final Class<?> superclass = type.getSuperclass();
        if ((superclass != null) && !superclass.equals(Object.class)) {
            buildTypeConvertersFromClassHierarchy(superclass, alreadyBuiltTypeConverters);
        }
    } catch (final NoClassDefFoundError e) {
        throw new RuntimeException("Failed to load superclass of [" + type.getName() + "]: " + e.getMessage(),
                e);
    }
}

From source file:CraftAPI.java

/**
 * Enables the plugin./*from  w  ww  . j a  v  a2s. c o  m*/
 */
@Override
public void enable() {
    logger.log(Level.INFO, "CraftAPI is installed");

    try {
        XMLConfiguration config = new XMLConfiguration("craftapi.xml");
        HierarchicalConfiguration authConfig = config.configurationAt("authentication");

        // XML-RPC server
        if (config.getBoolean("xml-rpc.enabled", false)) {
            try {
                // Get a custom authentication provider for the "XML-RPC"
                // service
                AuthenticationProvider auth = new ConfigurationAuthentication(authConfig, "XML-RPC");
                int port = config.getInt("xml-rpc.port", 20012);

                // Build the map of APIs that will be made available
                Map<String, Class> handlers = new HashMap<String, Class>();
                handlers.put("server", XMLRPCServerAPI.class);
                handlers.put("player", XMLRPCPlayerAPI.class);
                handlers.put("minecraft", XMLRPCMinecraftAPI.class);

                // Start!
                startServer(new XMLRPCInterface(port, handlers, auth));
            } catch (NoClassDefFoundError e) {
                logger.log(Level.SEVERE, "Missing libraries for XML-RPC support: " + e.getMessage());
            }
        }

        // Streaming API server
        if (config.getBoolean("streaming-api.enabled", false)) {
            try {
                // Get a custom authentication provider
                AuthenticationProvider auth = new ConfigurationAuthentication(authConfig, "StreamingAPI");
                int port = config.getInt("streaming-api.port", 20013);
                int maxConnections = config.getInt("streaming-api.max-connections", 10);
                String bindAddressStr = config.getString("streaming-api.bind-address");
                boolean useSSL = config.getBoolean("streaming-api.use-ssl", false);

                // Get bind address
                InetAddress bindAddress = null;
                if (bindAddressStr != null) {
                    bindAddress = InetAddress.getByName(bindAddressStr);
                }

                // Start!
                startServer(new StreamingAPIInterface(port, maxConnections, bindAddress, useSSL, auth,
                        eventDispatcher));
            } catch (UnknownHostException e) {
                logger.log(Level.SEVERE,
                        "Unknown bind address for the streaming API server: " + e.getMessage());
            } catch (NoClassDefFoundError e) {
                logger.log(Level.SEVERE, "Missing libraries for streaming API support: " + e.getMessage());
            }
        }
    } catch (ConfigurationException e) {
        logger.log(Level.SEVERE, "Failed to load CraftAPI configuration: " + e.getMessage());
    }
}