Search in sources :

Example 26 with StartException

use of org.jboss.msc.service.StartException in project wildfly by wildfly.

the class RemoteNamingServerService method start.

public synchronized void start(StartContext context) throws StartException {
    try {
        final Context namingContext = new NamingContext(namingStore.getValue(), new Hashtable<String, Object>());
        remoteNamingService = new RemoteNamingService(namingContext);
        remoteNamingService.start(endpoint.getValue());
    } catch (Exception e) {
        throw new StartException("Failed to start remote naming service", e);
    }
}
Also used : StopContext(org.jboss.msc.service.StopContext) StartContext(org.jboss.msc.service.StartContext) NamingContext(org.jboss.as.naming.NamingContext) Context(javax.naming.Context) StartException(org.jboss.msc.service.StartException) NamingContext(org.jboss.as.naming.NamingContext) RemoteNamingService(org.wildfly.naming.client.remote.RemoteNamingService) IOException(java.io.IOException) StartException(org.jboss.msc.service.StartException)

Example 27 with StartException

use of org.jboss.msc.service.StartException in project wildfly by wildfly.

the class WeldStartService method start.

@Override
public void start(final StartContext context) throws StartException {
    /*
         * Weld service restarts are not supported. Therefore, if we detect that Weld is being restarted we
         * trigger restart of the entire deployment.
         */
    if (runOnce.get()) {
        ServiceController<?> controller = context.getController().getServiceContainer().getService(deploymentServiceName);
        controller.addListener(new AbstractServiceListener<Object>() {

            @Override
            public void transition(final ServiceController<?> controller, final ServiceController.Transition transition) {
                if (transition.getAfter().equals(ServiceController.Substate.DOWN)) {
                    controller.setMode(Mode.ACTIVE);
                    controller.removeListener(this);
                }
            }
        });
        controller.setMode(Mode.NEVER);
        return;
    }
    runOnce.set(true);
    ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
    try {
        for (SetupAction action : setupActions) {
            action.setup(null);
        }
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
        bootstrap.getValue().getBootstrap().startInitialization();
        bootstrap.getValue().getBootstrap().deployBeans();
        bootstrap.getValue().getBootstrap().validateBeans();
        bootstrap.getValue().getBootstrap().endInitialization();
    } finally {
        for (SetupAction action : setupActions) {
            try {
                action.teardown(null);
            } catch (Exception e) {
                WeldLogger.DEPLOYMENT_LOGGER.exceptionClearingThreadState(e);
            }
        }
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
    }
}
Also used : ServiceController(org.jboss.msc.service.ServiceController) SetupAction(org.jboss.as.server.deployment.SetupAction) StartException(org.jboss.msc.service.StartException)

Example 28 with StartException

use of org.jboss.msc.service.StartException in project wildfly by wildfly.

the class DirectAdminObjectActivatorService method start.

@Override
public void start(StartContext context) throws StartException {
    ROOT_LOGGER.debugf("started DirectConnectionFactoryActivatorService %s", context.getController().getName());
    String aoClass = null;
    try {
        Connector cmd = mdr.getValue().getResourceAdapter(raId);
        if (cmd.getVersion() == Connector.Version.V_10) {
            throw ConnectorLogger.ROOT_LOGGER.adminObjectForJCA10(resourceAdapter, jndiName);
        } else {
            ResourceAdapter ra1516 = (ResourceAdapter) cmd.getResourceadapter();
            if (ra1516.getAdminObjects() != null) {
                for (AdminObject ao : ra1516.getAdminObjects()) {
                    if (ao.getAdminobjectClass().getValue().equals(className))
                        aoClass = ao.getAdminobjectClass().getValue();
                }
            }
        }
        if (aoClass == null || !aoClass.equals(className)) {
            throw ConnectorLogger.ROOT_LOGGER.invalidAdminObject(aoClass, resourceAdapter, jndiName);
        }
        Map<String, String> raConfigProperties = new HashMap<String, String>();
        Map<String, String> aoConfigProperties = new HashMap<String, String>();
        if (properties != null) {
            for (Map.Entry<String, String> prop : properties.entrySet()) {
                String key = prop.getKey();
                String value = prop.getValue();
                if (key.startsWith("ra.")) {
                    raConfigProperties.put(key.substring(3), value);
                } else if (key.startsWith("ao.")) {
                    aoConfigProperties.put(key.substring(3), value);
                } else {
                    aoConfigProperties.put(key, value);
                }
            }
        }
        org.jboss.jca.common.api.metadata.resourceadapter.AdminObject ao = new AdminObjectImpl(aoConfigProperties, aoClass, jndiName, poolName(aoClass, className), Boolean.TRUE, Boolean.TRUE);
        Activation activation = new ActivationImpl(null, null, TransactionSupportEnum.LocalTransaction, Collections.<ConnectionDefinition>emptyList(), Collections.singletonList(ao), null, Collections.<String>emptyList(), null, null);
        String serviceName = jndiName;
        serviceName = serviceName.replace(':', '_');
        serviceName = serviceName.replace('/', '_');
        ResourceAdapterActivatorService activator = new ResourceAdapterActivatorService(cmd, activation, module.getClassLoader(), serviceName);
        activator.setCreateBinderService(false);
        activator.setBindInfo(bindInfo);
        ServiceTarget serviceTarget = context.getChildTarget();
        ServiceBuilder adminObjectServiceBuilder = serviceTarget.addService(ConnectorServices.RESOURCE_ADAPTER_ACTIVATOR_SERVICE.append(serviceName), activator).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, activator.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, activator.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, activator.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, activator.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, activator.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, activator.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, activator.getCcmInjector()).addDependency(NamingService.SERVICE_NAME).addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER).addDependency(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append("default"));
        adminObjectServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
    } catch (Exception e) {
        throw new StartException(e);
    }
}
Also used : Connector(org.jboss.jca.common.api.metadata.spec.Connector) TransactionIntegration(org.jboss.jca.core.spi.transaction.TransactionIntegration) HashMap(java.util.HashMap) Activation(org.jboss.jca.common.api.metadata.resourceadapter.Activation) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) CachedConnectionManager(org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager) ActivationImpl(org.jboss.jca.common.metadata.resourceadapter.ActivationImpl) ResourceAdapter(org.jboss.jca.common.api.metadata.spec.ResourceAdapter) StartException(org.jboss.msc.service.StartException) AdminObject(org.jboss.jca.common.api.metadata.spec.AdminObject) ServiceTarget(org.jboss.msc.service.ServiceTarget) AdminObjectImpl(org.jboss.jca.common.metadata.resourceadapter.AdminObjectImpl) AS7MetadataRepository(org.jboss.as.connector.services.mdr.AS7MetadataRepository) StartException(org.jboss.msc.service.StartException) ManagementRepository(org.jboss.jca.core.api.management.ManagementRepository) HashMap(java.util.HashMap) Map(java.util.Map)

Example 29 with StartException

use of org.jboss.msc.service.StartException in project wildfly by wildfly.

the class UndertowDeploymentService method start.

@Override
public void start(final StartContext startContext) throws StartException {
    if (autostart) {
        // The start can trigger the web app context initialization which involves blocking tasks like
        // servlet context initialization, startup servlet initialization lifecycles and such. Hence this needs to be done asynchronously
        // to prevent the MSC threads from blocking
        startContext.asynchronous();
        serverExecutor.getValue().submit(new Runnable() {

            @Override
            public void run() {
                try {
                    startContext();
                    startContext.complete();
                } catch (Throwable e) {
                    startContext.failed(new StartException(e));
                }
            }
        });
    }
}
Also used : StartException(org.jboss.msc.service.StartException)

Example 30 with StartException

use of org.jboss.msc.service.StartException in project wildfly by wildfly.

the class ServiceContainerHelper method start.

/**
     * Ensures the specified service is started.
     * @param controller a service controller
     * @throws StartException if the specified service could not be started
     */
public static <T> void start(final ServiceController<T> controller) throws StartException {
    transition(controller, State.UP);
    StartException exception = controller.getStartException();
    if (exception != null) {
        throw exception;
    }
}
Also used : StartException(org.jboss.msc.service.StartException)

Aggregations

StartException (org.jboss.msc.service.StartException)43 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 ExecutorService (java.util.concurrent.ExecutorService)4 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)4 ORB (org.omg.CORBA.ORB)4 InetSocketAddress (java.net.InetSocketAddress)3 PrivilegedAction (java.security.PrivilegedAction)3 HashMap (java.util.HashMap)3 PostInitLoader (com.arjuna.orbportability.internal.utils.PostInitLoader)2 HandlerWrapper (io.undertow.server.HandlerWrapper)2 HttpHandler (io.undertow.server.HttpHandler)2 File (java.io.File)2 AccessControlContext (java.security.AccessControlContext)2 Map (java.util.Map)2 TempClassLoaderFactoryImpl (org.jboss.as.jpa.classloader.TempClassLoaderFactoryImpl)2 SocketBinding (org.jboss.as.network.SocketBinding)2 ModuleLoadException (org.jboss.modules.ModuleLoadException)2 Service (org.jboss.msc.service.Service)2 ServiceContainer (org.jboss.msc.service.ServiceContainer)2