use of org.opends.server.types.InitializationException 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;
}
Aggregations