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);
}
}
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);
}
}
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);
}
}
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));
}
}
});
}
}
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;
}
}
Aggregations