Search in sources :

Example 1 with ConfigException

use of org.opends.server.config.ConfigException in project midpoint by Evolveum.

the class OpenDJController method start.

/**
	 * Start the embedded OpenDJ directory server.
	 * 
	 * Configuration and databases from serverRoot location will be used.
	 * 
	 * @return
	 */
public InternalClientConnection start() {
    LOGGER.info("Starting OpenDJ server");
    DirectoryEnvironmentConfig envConfig = new DirectoryEnvironmentConfig();
    try {
        envConfig.setServerRoot(serverRoot);
        envConfig.setConfigFile(configFile);
    // envConfig.setDisableConnectionHandlers(true);
    } catch (InitializationException ex) {
        ex.printStackTrace();
        throw new RuntimeException("OpenDJ initialization failed", ex);
    }
    // Check if the server is already running
    if (EmbeddedUtils.isRunning()) {
        throw new RuntimeException("Server already running");
    } else {
        try {
            EmbeddedUtils.startServer(envConfig);
        } catch (ConfigException ex) {
            LOGGER.error("Possible OpenDJ misconfiguration: " + ex.getMessage(), ex);
            throw new RuntimeException("OpenDJ startup failed", ex);
        } catch (InitializationException ex) {
            LOGGER.error("OpenDJ startup failed", ex);
            throw new RuntimeException("OpenDJ startup failed", ex);
        }
    }
    internalConnection = InternalClientConnection.getRootConnection();
    if (internalConnection == null) {
        LOGGER.error("OpenDJ cannot get internal connection (null)");
        throw new RuntimeException("OpenDS cannot get internal connection (null)");
    }
    LOGGER.info("OpenDJ server started");
    return internalConnection;
}
Also used : ConfigException(org.opends.server.config.ConfigException) InitializationException(org.opends.server.types.InitializationException) DirectoryEnvironmentConfig(org.opends.server.types.DirectoryEnvironmentConfig)

Aggregations

ConfigException (org.opends.server.config.ConfigException)1 DirectoryEnvironmentConfig (org.opends.server.types.DirectoryEnvironmentConfig)1 InitializationException (org.opends.server.types.InitializationException)1