Search in sources :

Example 1 with DeploymentStartException

use of org.mule.runtime.deployment.model.api.DeploymentStartException in project mule by mulesoft.

the class DefaultMuleApplication method start.

@Override
public void start() {
    withContextClassLoader(null, () -> {
        if (logger.isInfoEnabled()) {
            logger.info(miniSplash(format("Starting app '%s'", descriptor.getName())));
        }
    });
    try {
        this.artifactContext.getMuleContext().start();
        // null CCL ensures we log at 'system' level
        // TODO getDomainClassLoader a more usable wrapper for any logger to be logged at sys level
        withContextClassLoader(null, () -> {
            if (logger.isInfoEnabled()) {
                ApplicationStartedSplashScreen splashScreen = new ApplicationStartedSplashScreen();
                splashScreen.createMessage(descriptor);
                logger.info(splashScreen.toString());
            }
        });
    } catch (Exception e) {
        setStatusToFailed();
        // log it here so it ends up in app log, sys log will only log a message without stacktrace
        if (e instanceof MuleException) {
            logger.error(((MuleException) e).getDetailedMessage());
        } else {
            logger.error(null, getRootCause(e));
        }
        throw new DeploymentStartException(createStaticMessage(format("Error starting application '%s'", descriptor.getName())), e);
    }
}
Also used : DeploymentStartException(org.mule.runtime.deployment.model.api.DeploymentStartException) InstallException(org.mule.runtime.deployment.model.api.InstallException) DeploymentStartException(org.mule.runtime.deployment.model.api.DeploymentStartException) DeploymentStopException(org.mule.runtime.deployment.model.api.DeploymentStopException) MuleException(org.mule.runtime.api.exception.MuleException) DeploymentInitException(org.mule.runtime.deployment.model.api.DeploymentInitException) MuleException(org.mule.runtime.api.exception.MuleException)

Example 2 with DeploymentStartException

use of org.mule.runtime.deployment.model.api.DeploymentStartException in project mule by mulesoft.

the class DefaultMuleDomain method start.

@Override
public void start() {
    try {
        if (this.artifactContext != null) {
            try {
                this.artifactContext.getMuleContext().start();
            } catch (MuleException e) {
                logger.error(null, getRootCause(e));
                throw new DeploymentStartException(createStaticMessage(getRootCauseMessage(e)), e);
            }
        }
        // null CCL ensures we log at 'system' level
        // TODO create a more usable wrapper for any logger to be logged at sys level
        withContextClassLoader(null, () -> {
            DomainStartedSplashScreen splashScreen = new DomainStartedSplashScreen();
            splashScreen.createMessage(descriptor);
            logger.info(splashScreen.toString());
        });
    } catch (Exception e) {
        throw new DeploymentStartException(createStaticMessage("Failure trying to start domain " + getArtifactName()), e);
    }
}
Also used : DeploymentStartException(org.mule.runtime.deployment.model.api.DeploymentStartException) MuleException(org.mule.runtime.api.exception.MuleException) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException) DeploymentStartException(org.mule.runtime.deployment.model.api.DeploymentStartException) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) FileNotFoundException(java.io.FileNotFoundException) DeploymentInitException(org.mule.runtime.deployment.model.api.DeploymentInitException) DeploymentStopException(org.mule.runtime.deployment.model.api.DeploymentStopException)

Aggregations

MuleException (org.mule.runtime.api.exception.MuleException)2 DeploymentInitException (org.mule.runtime.deployment.model.api.DeploymentInitException)2 DeploymentStartException (org.mule.runtime.deployment.model.api.DeploymentStartException)2 DeploymentStopException (org.mule.runtime.deployment.model.api.DeploymentStopException)2 FileNotFoundException (java.io.FileNotFoundException)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 InstallException (org.mule.runtime.deployment.model.api.InstallException)1