Search in sources :

Example 21 with MultiException

use of org.glassfish.hk2.api.MultiException in project Payara by payara.

the class ApplicationLifecycle method startContainers.

protected boolean startContainers(Collection<EngineInfo> containersInfo, Logger logger, DeploymentContext context) {
    ActionReport report = context.getActionReport();
    for (EngineInfo engineInfo : containersInfo) {
        Container container;
        try {
            container = engineInfo.getContainer();
        } catch (Exception e) {
            logger.log(SEVERE, KernelLoggerInfo.cantStartContainer, new Object[] { engineInfo.getSniffer().getModuleType(), e });
            return false;
        }
        Class<? extends Deployer> deployerClass = container.getDeployer();
        Deployer deployer;
        try {
            deployer = habitat.getService(deployerClass);
            engineInfo.setDeployer(deployer);
        } catch (MultiException e) {
            report.failure(logger, "Cannot instantiate or inject " + deployerClass, e);
            engineInfo.stop(logger);
            return false;
        } catch (ClassCastException e) {
            engineInfo.stop(logger);
            report.failure(logger, deployerClass + " does not implement " + " the org.jvnet.glassfish.api.deployment.Deployer interface", e);
            return false;
        }
    }
    return true;
}
Also used : EngineInfo(org.glassfish.internal.data.EngineInfo) Container(org.glassfish.api.container.Container) ActionReport(org.glassfish.api.ActionReport) MultiException(org.glassfish.hk2.api.MultiException) MultiException(org.glassfish.hk2.api.MultiException) DeploymentException(org.glassfish.deployment.common.DeploymentException) IOException(java.io.IOException) PropertyVetoException(java.beans.PropertyVetoException) RetryableException(org.jvnet.hk2.config.RetryableException) VersioningSyntaxException(org.glassfish.deployment.versioning.VersioningSyntaxException) Deployer(org.glassfish.api.deployment.Deployer)

Example 22 with MultiException

use of org.glassfish.hk2.api.MultiException in project Payara by payara.

the class CommandRunnerTest method validateParametersTest.

@Test
public void validateParametersTest() {
    ParameterMap params = new ParameterMap();
    params.set("foo", "bar");
    params.set("hello", "world");
    params.set("one", "two");
    try {
        cr.validateParameters(new CommandModelImpl(DummyAdminCommand.class), params);
    } catch (MultiException ce) {
        String expectedMessage = " Invalid option: one";
        assertTrue(ce.getMessage().contains(expectedMessage));
    }
}
Also used : ParameterMap(org.glassfish.api.admin.ParameterMap) CommandModelImpl(org.glassfish.common.util.admin.CommandModelImpl) MultiException(org.glassfish.hk2.api.MultiException) Test(org.junit.Test)

Aggregations

MultiException (org.glassfish.hk2.api.MultiException)20 IOException (java.io.IOException)5 Method (java.lang.reflect.Method)5 Param (org.glassfish.api.Param)3 RemoteCLICommand (com.sun.enterprise.admin.cli.remote.RemoteCLICommand)2 GrizzlyService (com.sun.enterprise.v3.services.impl.GrizzlyService)2 MalformedURLException (java.net.MalformedURLException)2 List (java.util.List)2 LogRecord (java.util.logging.LogRecord)2 MethodMetaData (org.glassfish.admin.rest.provider.MethodMetaData)2 ParameterMetaData (org.glassfish.admin.rest.provider.ParameterMetaData)2 ActionReport (org.glassfish.api.ActionReport)2 CommandModelImpl (org.glassfish.common.util.admin.CommandModelImpl)2 Attribute (org.jvnet.hk2.config.Attribute)2 ConfigModel (org.jvnet.hk2.config.ConfigModel)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 GraphHopper (com.graphhopper.GraphHopper)1 GraphHopperConfig (com.graphhopper.GraphHopperConfig)1 GraphHopperHealthCheck (com.graphhopper.http.health.GraphHopperHealthCheck)1 JTSTriangulator (com.graphhopper.isochrone.algorithm.JTSTriangulator)1