Search in sources :

Example 41 with StartException

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

the class AccessLogService method start.

@Override
public void start(StartContext context) throws StartException {
    if (useServerLog) {
        logReceiver = new JBossLoggingAccessLogReceiver();
    } else {
        if (pathRelativeTo != null) {
            callbackHandle = pathManager.getValue().registerCallback(pathRelativeTo, PathManager.ReloadServerCallback.create(), PathManager.Event.UPDATED, PathManager.Event.REMOVED);
        }
        directory = Paths.get(pathManager.getValue().resolveRelativePathEntry(path, pathRelativeTo));
        if (!Files.exists(directory)) {
            try {
                Files.createDirectories(directory);
            } catch (IOException e) {
                throw UndertowLogger.ROOT_LOGGER.couldNotCreateLogDirectory(directory, e);
            }
        }
        try {
            DefaultAccessLogReceiver.Builder builder = DefaultAccessLogReceiver.builder().setLogWriteExecutor(worker.getValue()).setOutputDirectory(directory).setLogBaseName(filePrefix).setLogNameSuffix(fileSuffix).setRotate(rotate);
            if (extended) {
                builder.setLogFileHeaderGenerator(new ExtendedAccessLogParser.ExtendedAccessLogHeaderGenerator(pattern));
                extendedPattern = new ExtendedAccessLogParser(getClass().getClassLoader()).parse(pattern);
            } else {
                extendedPattern = null;
            }
            logReceiver = builder.build();
        } catch (IllegalStateException e) {
            throw new StartException(e);
        }
    }
    host.getValue().setAccessLogService(this);
}
Also used : ExtendedAccessLogParser(io.undertow.server.handlers.accesslog.ExtendedAccessLogParser) StartException(org.jboss.msc.service.StartException) IOException(java.io.IOException) DefaultAccessLogReceiver(io.undertow.server.handlers.accesslog.DefaultAccessLogReceiver) JBossLoggingAccessLogReceiver(io.undertow.server.handlers.accesslog.JBossLoggingAccessLogReceiver)

Example 42 with StartException

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

the class ArjunaTransactionManagerService method start.

@Override
public synchronized void start(final StartContext context) throws StartException {
    final CoordinatorEnvironmentBean coordinatorEnvironmentBean = arjPropertyManager.getCoordinatorEnvironmentBean();
    coordinatorEnvironmentBean.setEnableStatistics(coordinatorEnableStatistics);
    coordinatorEnvironmentBean.setDefaultTimeout(coordinatorDefaultTimeout);
    coordinatorEnvironmentBean.setTransactionStatusManagerEnable(transactionStatusManagerEnable);
    // Object Store Browser bean
    Map<String, String> objStoreBrowserTypes = new HashMap<String, String>();
    objStoreBrowser = new ObjStoreBrowser();
    objStoreBrowserTypes.put("StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction", "com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean");
    objStoreBrowserTypes.put("StateManager/AbstractRecord/ConnectableResourceRecord", "com.arjuna.ats.internal.jta.tools.osb.mbean.jta.ConnectableResourceRecordBean");
    if (!jts) {
        // No IIOP, stick with JTA mode.
        jtaEnvironmentBean.getValue().setTransactionManagerClassName(com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate.class.getName());
        final com.arjuna.ats.jbossatx.jta.TransactionManagerService service = new com.arjuna.ats.jbossatx.jta.TransactionManagerService();
        final LocalUserTransaction userTransaction = LocalUserTransaction.getInstance();
        jtaEnvironmentBean.getValue().setUserTransaction(userTransaction);
        service.setJbossXATerminator(xaTerminatorInjector.getValue());
        service.setTransactionSynchronizationRegistry(new TransactionSynchronizationRegistryWrapper(ContextTransactionSynchronizationRegistry.getInstance()));
        try {
            service.create();
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.managerStartFailure(e, "Transaction");
        }
        service.start();
        value = service;
    } else {
        final ORB orb = orbInjector.getValue();
        new PostInitLoader(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"), orb);
        // IIOP is enabled, so fire up JTS mode.
        jtaEnvironmentBean.getValue().setTransactionManagerClassName(com.arjuna.ats.jbossatx.jts.TransactionManagerDelegate.class.getName());
        final com.arjuna.ats.jbossatx.jts.TransactionManagerService service = new com.arjuna.ats.jbossatx.jts.TransactionManagerService();
        final LocalUserTransaction userTransaction = LocalUserTransaction.getInstance();
        jtaEnvironmentBean.getValue().setUserTransaction(userTransaction);
        service.setJbossXATerminator(xaTerminatorInjector.getValue());
        service.setTransactionSynchronizationRegistry(new TransactionSynchronizationRegistryWrapper(ContextTransactionSynchronizationRegistry.getInstance()));
        service.setPropagateFullContext(true);
        // this is not great, but it's the only way presently to influence the behavior of com.arjuna.ats.internal.jbossatx.jts.InboundTransactionCurrentImple
        try {
            final Field field = TransactionManagerLocator.class.getDeclaredField("tm");
            field.setAccessible(true);
            field.set(TransactionManagerLocator.getInstance(), jtaEnvironmentBean.getValue().getTransactionManager());
        } catch (IllegalAccessException e) {
            throw new IllegalAccessError(e.getMessage());
        } catch (NoSuchFieldException e) {
            throw new NoSuchFieldError(e.getMessage());
        }
        objStoreBrowserTypes.put("StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple", "com.arjuna.ats.arjuna.tools.osb.mbean.ActionBean");
        try {
            service.create();
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.createFailed(e);
        }
        try {
            service.start(orb);
        } catch (Exception e) {
            throw TransactionLogger.ROOT_LOGGER.startFailure(e);
        }
        value = service;
    }
    try {
        objStoreBrowser.start();
    } catch (Exception e) {
        throw TransactionLogger.ROOT_LOGGER.objectStoreStartFailure(e);
    }
}
Also used : HashMap(java.util.HashMap) ObjStoreBrowser(com.arjuna.ats.arjuna.tools.osb.mbean.ObjStoreBrowser) TransactionSynchronizationRegistryWrapper(org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper) Field(java.lang.reflect.Field) LocalUserTransaction(org.wildfly.transaction.client.LocalUserTransaction) CoordinatorEnvironmentBean(com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean) PostInitLoader(com.arjuna.orbportability.internal.utils.PostInitLoader) StartException(org.jboss.msc.service.StartException) ORB(org.omg.CORBA.ORB)

Example 43 with StartException

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

the class CoreEnvironmentService method start.

@Override
public void start(StartContext context) throws StartException {
    // Global configuration.
    final CoreEnvironmentBean coreEnvironmentBean = arjPropertyManager.getCoreEnvironmentBean();
    if (coreEnvironmentBean.getProcessImplementationClassName() == null) {
        UuidProcessId id = new UuidProcessId();
        coreEnvironmentBean.setProcessImplementation(id);
    }
    try {
        coreEnvironmentBean.setNodeIdentifier(nodeIdentifier);
    } catch (CoreEnvironmentBeanException e) {
        throw new StartException(e.getCause());
    }
    // Setup the socket process id if there is a binding
    SocketBinding binding = socketProcessBindingInjector.getOptionalValue();
    if (binding != null) {
        int port = binding.getPort();
        coreEnvironmentBean.setSocketProcessIdPort(port);
    }
}
Also used : SocketBinding(org.jboss.as.network.SocketBinding) CoreEnvironmentBeanException(com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException) CoreEnvironmentBean(com.arjuna.ats.arjuna.common.CoreEnvironmentBean) StartException(org.jboss.msc.service.StartException) UuidProcessId(com.arjuna.ats.internal.arjuna.utils.UuidProcessId)

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