Example usage for java.lang NoClassDefFoundError getLocalizedMessage

List of usage examples for java.lang NoClassDefFoundError getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.ebayopensource.turmeric.eclipse.functional.test.ft.wsdlsvc.ConsumerFromIntfTest.java

@Test
@Ignore("failing")
public void testConsumeCalculatorSvc() throws Exception {

    // Turn on the auto-build for the builders to kick-in
    SimpleTestUtil.setAutoBuilding(true);

    try {/*from w  ww  .jav a2 s  .co m*/
        Boolean b = createServiceFromWsdl(new File(WSDL_FILE).toURI().toURL(), namespacePart);

        Assert.assertTrue(adminName + "  creation failed", b);

        StringBuffer failMessages = ProjectArtifactValidator.getErroredFileMessage();

        ProjectArtifactValidator.getErroredFileMessage().setLength(0);
        // validate artifacts
        boolean intfMatch = ServiceSetupCleanupValidate
                .validateIntfArtifacts(WorkspaceUtil.getProject(adminName), adminName);
        Assert.assertTrue(" --- Service artifacts validation failed for " + failMessages, intfMatch);

        String consumerId = "CalcConsumer_Id";
        List<String> environment = new ArrayList<String>();
        environment.add("production");
        ConsumerFromJavaParamModel model = new ConsumerFromJavaParamModel();
        model.setBaseConsumerSrcDir("src");
        model.setClientName(adminName + "Consumer");
        ArrayList<String> list = new ArrayList<String>();
        list.add(adminName);
        model.setServiceNames(list);
        model.setParentDirectory(PARENT_DIR);
        model.setConsumerId(consumerId);
        model.setEnvironments(environment);

        SimpleTestUtil.setAutoBuilding(false);

        ServiceCreator.createConsumerFromJava(model, ProgressUtil.getDefaultMonitor(null));
        SimpleTestUtil.setAutoBuilding(true);
        // Add validation for the expected artifacts and contents..
        boolean consumerMatch = ServiceSetupCleanupValidate.validateConsumerArtifacts(
                WorkspaceUtil.getProject(adminName + "Consumer"), adminName + "Consumer");

        System.out.println(failMessages.toString());
        Assert.assertTrue(" --- Service artifacts validation failed for " + failMessages.toString(),
                consumerMatch);
        ProjectArtifactValidator.getErroredFileMessage().setLength(0);

        // we know that the CC.xml or GCC.xml is the last artifact to be
        // created
        // The project exists as
        IProject consProject = WorkspaceUtil.getProject(model.getClientName());

        consProject.build(IncrementalProjectBuilder.FULL_BUILD, ProgressUtil.getDefaultMonitor(null));
        // if project build goes through, its a successful test
    } catch (NoClassDefFoundError ex) {
        assumeNoException(ex);
    } catch (Exception ex) {
        System.out.println("--- Exception in consumeCalculatorSvc() - " + ex.getMessage());
        System.out.println("--- Exception in consumeCalculatorSvc() toString - " + ex.toString());
        System.out.println("--- Exception in consumeCalculatorSvc() getCause - " + ex.getCause().getMessage());
        Assert.fail("Exception in consumeCalculatorSvc() - " + ex.getLocalizedMessage());
    }
}

From source file:org.mc4j.ems.impl.jmx.connection.bean.attribute.DAttribute.java

/**
 * Updates the local value of this mbean from the server
 * <p/>/*from w ww  . ja  v a 2s.c o  m*/
 * TODO we should not update to null on failure, but retain the last known
 */
public synchronized Object refresh() {
    loaded = true;
    Object newValue = null;
    try {
        MBeanServer server = bean.getConnectionProvider().getMBeanServer();
        newValue = server.getAttribute(bean.getObjectName(), getName());

    } catch (ReflectionException e) {
        supportedType = false;
        registerFailure(e);
        throw new EmsException("Could not load attribute value " + e.toString(), e);
    } catch (InstanceNotFoundException e) {
        registerFailure(e);
        throw new EmsException(
                "Could not load attribute value, bean instance not found " + bean.getObjectName().toString(),
                e);
    } catch (MBeanException e) {
        registerFailure(e);
        Throwable t = e.getTargetException();
        if (t != null)
            throw new EmsException(
                    "Could not load attribute value, target bean threw exception " + t.getLocalizedMessage(),
                    t);
        else
            throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(), e);
    } catch (AttributeNotFoundException e) {
        registerFailure(e);
        throw new EmsException("Could not load attribute value, attribute [" + getName() + "] not found", e);
    } catch (UndeclaredThrowableException e) {
        if (e.getUndeclaredThrowable() instanceof InvocationTargetException) {
            Throwable t = e.getCause();
            if (t.getCause() instanceof NotSerializableException) {
                supportedType = false;
                registerFailure(t.getCause());
                throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(),
                        t.getCause());
            } else
                throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(), t);
        }
        throw new EmsException("Could not load attribute value " + e.getLocalizedMessage(), e);
    } catch (RuntimeException re) {
        supportedType = false;

        // TODO GH: Figure this one out
        // Getting weblogic.management.NoAccessRuntimeException on wl9
        registerFailure(re);
        throw new EmsException("Could not load attribute value " + re.getLocalizedMessage(), re);
    } catch (NoClassDefFoundError ncdfe) {
        supportedType = false;
        registerFailure(ncdfe);
        throw new EmsException("Could not load attribute value " + ncdfe.getLocalizedMessage(), ncdfe);
    } catch (Throwable t) {
        throw new EmsException("Could not load attribute value " + t.getLocalizedMessage(), t);
    }
    alterValue(newValue);
    return newValue;
}