Example usage for java.security Security getProviders

List of usage examples for java.security Security getProviders

Introduction

In this page you can find the example usage for java.security Security getProviders.

Prototype

public static Provider[] getProviders() 

Source Link

Document

Returns an array containing all the installed providers.

Usage

From source file:de.rrze.idmone.utils.jpwgen.RandomFactory.java

@SuppressWarnings("rawtypes")
public Set<String> getServiceProviderFor(String type) {
    Set<String> result = new HashSet<String>();

    Provider[] providers = Security.getProviders();
    for (int i = 0; i < providers.length; i++) {
        // Get services provided by each provider

        Set keys = providers[i].keySet();
        for (Iterator it = keys.iterator(); it.hasNext();) {
            String key = (String) it.next();
            key = key.split(" ")[0]; //$NON-NLS-1$

            if (key.startsWith(type + ".")) //$NON-NLS-1$
            {/*from w  ww  .j a v  a 2s . c o  m*/
                result.add(key.substring(type.length() + 1));
            } else if (key.startsWith(ALG_PARSE_STRING + type + ".")) //$NON-NLS-1$
            {
                // This is an alias
                result.add(key.substring(type.length() + 11));
            }
        }
    }
    return result;
}

From source file:net.lightbody.bmp.proxy.jetty.http.SunJsseListener.java

protected SSLServerSocketFactory createFactory() throws Exception {
    _keystore = System.getProperty(KEYSTORE_PROPERTY, _keystore);

    log.info(KEYSTORE_PROPERTY + "=" + _keystore);

    if (_password == null)
        _password = Password.getPassword(PASSWORD_PROPERTY, null, null);
    log.info(PASSWORD_PROPERTY + "=" + _password.toStarString());

    if (_keypassword == null)
        _keypassword = Password.getPassword(KEYPASSWORD_PROPERTY, null, _password.toString());
    log.info(KEYPASSWORD_PROPERTY + "=" + _keypassword.toStarString());

    KeyStore ks = null;/*from ww  w  .  j  a  v  a2  s  .com*/

    log.info(KEYSTORE_TYPE_PROPERTY + "=" + _keystore_type);

    if (_keystore_provider_class != null) {
        // find provider.
        // avoid creating another instance if already installed in Security.
        java.security.Provider[] installed_providers = Security.getProviders();
        java.security.Provider myprovider = null;
        for (int i = 0; i < installed_providers.length; i++) {
            if (installed_providers[i].getClass().getName().equals(_keystore_provider_class)) {
                myprovider = installed_providers[i];
                break;
            }
        }
        if (myprovider == null) {
            // not installed yet, create instance and add it
            myprovider = (java.security.Provider) Class.forName(_keystore_provider_class).newInstance();
            Security.addProvider(myprovider);
        }
        log.info(KEYSTORE_PROVIDER_CLASS_PROPERTY + "=" + _keystore_provider_class);
        ks = KeyStore.getInstance(_keystore_type, myprovider.getName());
    } else if (_keystore_provider_name != null) {
        log.info(KEYSTORE_PROVIDER_NAME_PROPERTY + "=" + _keystore_provider_name);
        ks = KeyStore.getInstance(_keystore_type, _keystore_provider_name);
    } else {
        ks = KeyStore.getInstance(_keystore_type);
        log.info(KEYSTORE_PROVIDER_NAME_PROPERTY + "=[DEFAULT]");
    }

    ks.load(new FileInputStream(new File(_keystore)), _password.toString().toCharArray());

    KeyManagerFactory km = KeyManagerFactory.getInstance("SunX509", "SunJSSE");
    km.init(ks, _keypassword.toString().toCharArray());
    KeyManager[] kma = km.getKeyManagers();

    TrustManagerFactory tm = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
    if (_useDefaultTrustStore) {
        tm.init((KeyStore) null);
    } else {
        tm.init(ks);
    }

    TrustManager[] tma = tm.getTrustManagers();

    SSLContext sslc = SSLContext.getInstance("SSL");
    sslc.init(kma, tma, SecureRandom.getInstance("SHA1PRNG"));

    SSLServerSocketFactory ssfc = sslc.getServerSocketFactory();
    log.info("SSLServerSocketFactory=" + ssfc);
    return ssfc;
}

From source file:de.rrze.idmone.utils.jidgen.random.RandomFactory.java

public Provider[] getProviders() {
    return Security.getProviders();
}

From source file:org.guanxi.sp.engine.Bootstrap.java

/**
 * Called by Spring when application events occur. At the moment we handle:
 * ContextClosedEvent/*from w w  w  .j  a  v  a  2s .  com*/
 * ContextRefreshedEvent
 * RequestHandledEvent
 *
 * This is where we inject the job controllers into the application context, each one
 * under it's own key.
 * 
 * To understand the different events see
 * http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#context-functionality-events
 *
 * @param applicationEvent Spring application event
 */
public void onApplicationEvent(ApplicationEvent applicationEvent) {

    /* 
     * ContextClosedEvent
     * Published when the ApplicationContext is closed, using the 
     * close() method on the ConfigurableApplicationContext  
     * interface. "Closed" here means that all singleton beans are 
     * destroyed. A closed context has reached its end of life; it 
     * cannot be refreshed or restarted.
     */
    if (applicationEvent instanceof ContextClosedEvent) {
        if (okToUnloadBCProvider) {
            Provider[] providers = Security.getProviders();

            /* Although addProvider() returns the ID of the newly installed provider,
             * we can't rely on this. If another webapp removes a provider from the list of
             * installed providers, all the other providers shuffle up the list by one, thus
             * invalidating the ID we got from addProvider().
             */
            try {
                for (int i = 0; i < providers.length; i++) {
                    if (providers[i].getName().equalsIgnoreCase(Guanxi.BOUNCY_CASTLE_PROVIDER_NAME)) {
                        Security.removeProvider(Guanxi.BOUNCY_CASTLE_PROVIDER_NAME);
                    }
                }

                // Stop the jobs
                scheduler.shutdown();
            } catch (SecurityException se) {
                /* We'll end up here if a security manager is installed and it refuses us
                 * permission to remove the BouncyCastle provider
                 */
            } catch (SchedulerException se) {
                logger.error("Could not stop jobs", se);
            }
        }
    }

    /*
     * ContextRefreshedEvent  
     * Published when the ApplicationContext is initialised or 
     * refreshed, e.g. using the refresh() method on the 
     * ConfigurableApplicationContext interface. "Initialised" 
     * here means that all beans are loaded, post-processor 
     * beans are detected and activated, singletons are 
     * pre-instantiated, and the ApplicationContext object is 
     * ready for use. A refresh may be triggered multiple times, 
     * as long as the context hasn't been closed - provided that 
     * the chosen ApplicationContext  actually supports such 
     * "hot" refreshes (which e.g. XmlWebApplicationContext does 
     * but GenericApplicationContext doesn't).
     */
    else if (applicationEvent instanceof ContextRefreshedEvent) {
        // Advertise the application as available for business
        servletContext.setAttribute(Guanxi.CONTEXT_ATTR_ENGINE_CONFIG, config);

        logger.info("init : " + config.getId());
    }
}

From source file:eu.fthevenet.binjr.data.adapters.HttpDataAdapterBase.java

protected static SSLContext createSslCustomContext()
        throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException,
        KeyManagementException, UnrecoverableKeyException, NoSuchProviderException {
    // Load platform specific Trusted CA keystore
    logger.trace(() -> "Available Java Security providers: " + Arrays.toString(Security.getProviders()));
    KeyStore tks;/*from w w  w .  j a v  a 2 s. c  o  m*/
    switch (AppEnvironment.getInstance().getOsFamily()) {
    case WINDOWS:
        tks = KeyStore.getInstance("Windows-ROOT", "SunMSCAPI");
        tks.load(null, null);
        break;
    case OSX:
        tks = KeyStore.getInstance("KeychainStore", "Apple");
        tks.load(null, null);
        break;
    case LINUX:
    case UNSUPPORTED:
    default:
        tks = null;
        break;
    }
    return SSLContexts.custom().loadTrustMaterial(tks, null).build();
}

From source file:org.guanxi.idp.Bootstrap.java

/**
 * Called by Spring when application events occur. At the moment we handle:
 * ContextClosedEvent//from   w w w  .  j a v a 2 s.c o  m
 * ContextRefreshedEvent
 * RequestHandledEvent
 *
 * This is where we inject the job controllers into the application context, each one
 * under it's own key.
 *
 * @param applicationEvent Spring application event
 */
public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent instanceof ContextRefreshedEvent) {
        logger.info("Bootstrap init");

        // Inject the metadata farm to handle all source of metadata
        servletContext.setAttribute(Guanxi.CONTEXT_ATTR_IDP_ENTITY_FARM, entityFarm);
    }

    if (applicationEvent instanceof ContextClosedEvent) {
        if (okToUnloadBCProvider) {
            Provider[] providers = Security.getProviders();

            /* Although addProvider() returns the ID of the newly installed provider,
             * we can't rely on this. If another webapp removes a provider from the list of
             * installed providers, all the other providers shuffle up the list by one, thus
             * invalidating the ID we got from addProvider().
             */
            try {
                for (int i = 0; i < providers.length; i++) {
                    if (providers[i].getName().equalsIgnoreCase(Guanxi.BOUNCY_CASTLE_PROVIDER_NAME)) {
                        Security.removeProvider(Guanxi.BOUNCY_CASTLE_PROVIDER_NAME);
                    }
                }

                // Stop the jobs
                scheduler.shutdown();
            } catch (SecurityException se) {
                /* We'll end up here if a security manager is installed and it refuses us
                 * permission to remove the BouncyCastle provider
                 */
            } catch (SchedulerException se) {
                logger.error("Could not stop jobs", se);
            }
        }
    }

    if (applicationEvent instanceof RequestHandledEvent) {
    }
}

From source file:net.jmhertlein.core.crypto.Keys.java

/**
 * Generates a new Elliptic Curve Digital Signature Algorithm (ECDSA) public/private key pair.
 *
 * The system's default SecureRandom is used, and the secp521r1 named elliptic curve is used
 *
 * The BouncyCastle provider is used if possible, otherwise the most-preferred installed JCE provider is used
 *
 * @return a new ECDSA key pair/*w  w w .  j  a  v  a  2 s  .c om*/
 */
public static KeyPair newECDSAKeyPair() {
    if (Security.getProvider("BC") == null)
        return newECDSAKeyPair("secp521r1", Security.getProviders()[0].getName());
    else
        return newECDSAKeyPair("secp521r1", "BC");
}

From source file:eu.eidas.auth.engine.core.impl.SignP12.java

/**
 * Load cryptographic service provider.//from  w  ww  .  j av a2s.c o m
 * 
 * @throws SAMLEngineException the SAML engine exception
 */
public void loadCryptServiceProvider() throws SAMLEngineException {
    LOG.info("Load Cryptographic Service Provider");

    FileInputStream fis = null;
    FileInputStream fisTrustStore = null;

    try {
        // Dynamically register Bouncy Castle provider.
        boolean found = false;
        // Check if BouncyCastle is already registered as a provider
        final Provider[] providers = Security.getProviders();
        for (int i = 0; i < providers.length; i++) {
            if (providers[i].getName().equals(BouncyCastleProvider.PROVIDER_NAME)) {
                found = true;
            }
        }

        // Register only if the provider has not been previously registered
        if (!found) {
            LOG.debug("SAMLCore: Register Bouncy Castle provider.");
            Security.insertProviderAt(new BouncyCastleProvider(), Security.getProviders().length);
        }

        p12Store = KeyStore.getInstance(getProperties().getProperty("keystoreType"));

        fis = new FileInputStream(getProperties().getProperty("keystorePath"));

        p12Store.load(fis, getProperties().getProperty("keyStorePassword").toCharArray());

        trustStore = KeyStore.getInstance(getProperties().getProperty("trustStoreType"));

        fisTrustStore = new FileInputStream(getProperties().getProperty("trustStorePath"));
        trustStore.load(fisTrustStore, getProperties().getProperty("trustStorePassword").toCharArray());

    } catch (Exception e) {
        throw new SAMLEngineException("Error loading CryptographicServiceProvider", e);
    } finally {
        IOUtils.closeQuietly(fis);
        IOUtils.closeQuietly(fisTrustStore);
    }
}

From source file:eu.eidas.auth.engine.core.impl.SignSW.java

/**
 * Load cryptographic service provider.//from   www.j a v  a 2  s.  c om
 *
 * @throws SAMLEngineException the SAML engine exception
 */
public final void loadCryptServiceProvider() throws SAMLEngineException {
    LOG.info("Load Cryptographic Service Provider");
    try {
        // Dynamically register Bouncy Castle provider.
        boolean found = false;
        // Check if BouncyCastle is already registered as a provider
        final Provider[] providers = Security.getProviders();
        for (int i = 0; i < providers.length; i++) {
            if (providers[i].getName().equals(BouncyCastleProvider.PROVIDER_NAME)) {
                found = true;
            }
        }

        // Register only if the provider has not been previously registered
        if (!found) {
            LOG.debug("SAMLCore: Register Bouncy Castle provider.");
            Security.insertProviderAt(new BouncyCastleProvider(), 0);
        }

        ownKeyStore = loadKeystore(null);
        metadatKeyStore = loadKeystore(PROPERTY_PREFIX_METADATA);

    } catch (Exception e) {
        LOG.info("ERROR : Error loading CryptographicServiceProvider", e.getMessage());
        LOG.debug("ERROR : Error loading CryptographicServiceProvider", e);
        throw new SAMLEngineException("Error loading CryptographicServiceProvider", e);
    }
}

From source file:com.twinsoft.convertigo.engine.Engine.java

public static synchronized void start() throws EngineException {
    if (Engine.theApp == null) {
        System.out.println("Starting Convertigo Enterprise Mobility Server");

        // If the engine has been stopped by the admin, we must reload
        // properties
        EnginePropertiesManager.loadProperties();

        boolean bProjectsDataCompatibilityMode = Boolean.parseBoolean(
                EnginePropertiesManager.getProperty(PropertyName.PROJECTS_DATA_COMPATIBILITY_MODE));

        if (bProjectsDataCompatibilityMode) {
            System.out.println("Projects data compatibility mode required");
            try {
                Engine.PROJECTS_PATH = new File(Engine.WEBAPP_PATH + "/projects").getCanonicalPath();
                File projectsDir = new File(Engine.PROJECTS_PATH);
                projectsDir.mkdir();/*  w  w w .  ja  v  a 2 s.c  o m*/
            } catch (IOException e) {
                throw new EngineException("Unable to update projects path for compatibility mode", e);
            }
        }

        isStarted = false;
        isStartFailed = false;
        RequestableObject.nbCurrentWorkerThreads = 0;

        Engine.startStopDate = System.currentTimeMillis();

        System.out.println("Creating/updating loggers");

        String logFile = EnginePropertiesManager.getProperty(PropertyName.LOG4J_APPENDER_CEMSAPPENDER_FILE);
        System.out.println("Log file: " + logFile);

        // Main loggers
        Engine.logConvertigo = Logger.getLogger("cems");
        Engine.logEngine = Logger.getLogger("cems.Engine");
        Engine.logAdmin = Logger.getLogger("cems.Admin");
        Engine.logBeans = Logger.getLogger("cems.Beans");
        Engine.logBillers = Logger.getLogger("cems.Billers");
        Engine.logEmulators = Logger.getLogger("cems.Emulators");
        Engine.logContext = Logger.getLogger("cems.Context");
        Engine.logUser = Logger.getLogger("cems.Context.User");
        Engine.logUsageMonitor = Logger.getLogger("cems.UsageMonitor");
        Engine.logStatistics = Logger.getLogger("cems.Statistics");
        Engine.logScheduler = Logger.getLogger("cems.Scheduler");
        Engine.logSiteClipper = Logger.getLogger("cems.SiteClipper");
        /** #3437 : Disabled ExternalBrowser feature because it's not terminated
        Engine.logExternalBrowser = Logger.getLogger("cems.ExternalBrowser");
        */
        Engine.logAudit = Logger.getLogger("cems.Context.Audit");

        // Managers
        Engine.logContextManager = Logger.getLogger("cems.ContextManager");
        Engine.logCacheManager = Logger.getLogger("cems.CacheManager");
        Engine.logTracePlayerManager = Logger.getLogger("cems.TracePlayerManager");
        Engine.logJobManager = Logger.getLogger("cems.JobManager");
        Engine.logCertificateManager = Logger.getLogger("cems.CertificateManager");
        Engine.logDatabaseObjectManager = Logger.getLogger("cems.DatabaseObjectManager");
        Engine.logProxyManager = Logger.getLogger("cems.ProxyManager");
        Engine.logDevices = Logger.getLogger("cems.Devices");
        Engine.logCouchDbManager = Logger.getLogger("cems.CouchDbManager");
        Engine.logSecurityTokenManager = Logger.getLogger("cems.SecurityTokenManager");

        // Logger for compatibility issues
        Engine.log = new LogWrapper(Engine.logConvertigo);
        LogWrapper.initWrapper(Engine.logEmulators);

        try {
            Engine.logEngine.info("===========================================================");
            Engine.logEngine.info("Web app home: " + Engine.WEBAPP_PATH);
            Engine.logEngine.info("User workspace: " + Engine.USER_WORKSPACE_PATH);
            Engine.logEngine.info("Configuration path: " + Engine.CONFIGURATION_PATH);

            Engine.logEngine.info("Projects path: " + Engine.PROJECTS_PATH);
            if (bProjectsDataCompatibilityMode) {
                Engine.logEngine.warn("Projects data compatibility mode required");
            }

            Engine.logEngine.info("Log: " + Engine.LOG_PATH);

            if (cloud_customer_name != null) {
                Engine.logEngine.info("Cloud customer: " + cloud_customer_name);
            }

            // Check environment and native dependencies
            if (!isStudioMode()) {
                StartupDiagnostics.run();
            }

            // Initializing the engine
            Engine.theApp = new Engine();

            CachedIntrospector.prefetchDatabaseObjectsAsync();

            try {
                Engine.theApp.usageMonitor = new UsageMonitor();
                Engine.theApp.usageMonitor.init();

                Thread vulture = new Thread(Engine.theApp.usageMonitor);
                vulture.setName("UsageMonitor");
                vulture.setDaemon(true);
                vulture.start();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to launch the usage monitor.", e);
            }

            Engine.theApp.eventManager = new EventManager();
            Engine.theApp.eventManager.init();

            Engine.theApp.databaseObjectsManager = new DatabaseObjectsManager();
            Engine.theApp.databaseObjectsManager.init();

            Engine.theApp.sqlConnectionManager = new JdbcConnectionManager();
            Engine.theApp.sqlConnectionManager.init();

            Engine.theApp.filePropertyManager = new FilePropertyManager();
            Engine.theApp.filePropertyManager.init();

            try {
                Engine.theApp.proxyManager = new ProxyManager();
                Engine.theApp.proxyManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to launch the proxy manager.", e);
            }

            try {
                Engine.theApp.billingManager = new BillingManager();
                Engine.theApp.billingManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to launch the billing manager.", e);
            }

            // Initialization of the trace player
            try {
                Engine.theApp.tracePlayerManager = new TracePlayerManager();
                Engine.theApp.tracePlayerManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to run the trace player.", e);
            }

            try {
                Engine.theApp.minificationManager = new MinificationManager();
                Engine.theApp.minificationManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to run the minification manager.", e);
            }

            try {
                Engine.theApp.couchDbManager = new CouchDbManager();
                Engine.theApp.couchDbManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to run the couchDbProxy manager.", e);
            }

            try {
                Engine.theApp.pluginsManager = new PluginsManager();
                Engine.theApp.pluginsManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to run the plugins manager.", e);
            }

            try {
                Engine.theApp.restApiManager = RestApiManager.getInstance();
                Engine.theApp.restApiManager.init();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to run the rest api manager.", e);
            }

            Engine.logEngine.info("Current working directory is '" + System.getProperty("user.dir") + "'.");

            // Creating the Carioca Authentication objects
            Engine.logEngine.debug("Creating the Carioca Authentication objects");
            String cariocaUserName = EnginePropertiesManager
                    .getProperty(PropertyName.CARIOCA_DEFAULT_USER_NAME);
            String cariocaPassword = EnginePropertiesManager
                    .getProperty(PropertyName.CARIOCA_DEFAULT_USER_PASSWORD);
            Engine.theApp.authentications = new HashMap<String, Authentication>();

            // Initialization of the default TAS properties
            try {
                KeyManager.log = new LogWrapper(Engine.logEngine);
                Authentication auth = Engine.theApp.getAuthenticationObject("", null);
                auth.login(cariocaUserName, cariocaPassword);
            } catch (Exception e) {
                Engine.logEngine.error("The authentication to Carioca has failed (user name: \""
                        + cariocaUserName + "\", user password: \"" + cariocaPassword + "\").", e);
            }

            // TODO : retrieve SOA flag from KeyManager
            isSOA = true;

            // Creation of the session manager
            Engine.theApp.sessionManager = new SessionManager();
            Engine.theApp.sessionManager.setLog(new LogWrapper(Engine.logEngine));
            Engine.theApp.sessionManager.setProductCode(SessionManager.CONVERTIGO);

            String s = EnginePropertiesManager.getProperty(PropertyName.CONNECTORS_MONITORING);
            Engine.theApp.setMonitored(s.equalsIgnoreCase("true"));

            // Create Projects directory if needed
            File projectsDirFile = new File(Engine.PROJECTS_PATH);
            try {
                if (!projectsDirFile.exists())
                    projectsDirFile.mkdirs();
            } catch (Exception e) {
                Engine.logEngine.error("An error occured while creating projects directory.", e);
            }

            // Starts projects migration process
            MigrationManager.performProjectsMigration();

            // Security providers registration
            try {
                File dir = new File(Engine.CERTIFICATES_PATH);
                String[] files = dir.list(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return name.endsWith((".pkcs11"));
                    }
                });

                if (files != null && files.length > 0) {
                    Engine.logEngine.info("Registering security providers...");
                    try {
                        Class<?> sunPKCS11Class = Class.forName("sun.security.pkcs11.SunPKCS11");
                        String file;

                        for (int i = 0; i < files.length; i++) {
                            file = Engine.CERTIFICATES_PATH + "/" + files[i];
                            try {
                                Constructor<?> constructor = sunPKCS11Class
                                        .getConstructor(new Class[] { String.class });
                                Provider provider = (Provider) constructor.newInstance(new Object[] { file });
                                Security.addProvider(provider);
                                Engine.logEngine.info("Provider '" + provider.getName()
                                        + "' has been successfully registered.");
                            } catch (Exception e) {
                                Engine.logEngine.error("Unable to register security provider from file: " + file
                                        + " . Please check that the implementation library is in the Java lib path.");
                            }
                        }
                    } catch (ClassNotFoundException e) {
                        Engine.logEngine.error(
                                "Unable to find sun.security.pkcs11.SunPKCS11 class! PKCS#11 authentication won't be available. You must use JVM 1.5 or higher in order to use PKCS#11 authentication.");
                    }
                }

                Provider[] providers = Security.getProviders();
                String sProviders = "";
                for (int i = 0; i < providers.length; i++) {
                    sProviders += providers[i].getName() + ", ";
                }
                Engine.logEngine.debug("Registered providers: " + sProviders);
            } catch (Exception e) {
                Engine.logEngine.error("Unable to register security providers.", e);
            }

            // Launch the cache manager
            try {
                String cacheManagerClassName = EnginePropertiesManager
                        .getProperty(PropertyName.CACHE_MANAGER_CLASS);
                Engine.logEngine.debug("Cache manager class: " + cacheManagerClassName);
                Engine.theApp.cacheManager = (CacheManager) Class.forName(cacheManagerClassName).newInstance();
                Engine.theApp.cacheManager.init();

                Thread vulture = new Thread(Engine.theApp.cacheManager);
                Engine.theApp.cacheManager.executionThread = vulture;
                vulture.setName("CacheManager");
                vulture.setDaemon(true);
                vulture.start();
            } catch (Exception e) {
                Engine.logEngine.error("Unable to launch the cache manager.", e);
            }

            // Launch the thread manager
            try {
                Engine.theApp.threadManager = new ThreadManager();
                Engine.theApp.threadManager.init();

                Thread vulture = new Thread(Engine.theApp.threadManager);
                Engine.theApp.threadManager.executionThread = vulture;
                vulture.setName("ThreadManager");
                vulture.setDaemon(true);
                vulture.start();
            } catch (Exception e) {
                Engine.theApp.threadManager = null;
                Engine.logEngine.error("Unable to launch the thread manager.", e);
            }

            // Launch the context manager
            try {
                Engine.theApp.contextManager = new ContextManager();
                Engine.theApp.contextManager.init();

                Thread vulture = new Thread(Engine.theApp.contextManager);
                Engine.theApp.contextManager.executionThread = vulture;
                vulture.setName("ContextManager");
                vulture.setDaemon(true);
                vulture.start();
            } catch (Exception e) {
                Engine.theApp.contextManager = null;
                Engine.logEngine.error("Unable to launch the context manager.", e);
            }

            // Launch the security token manager
            Engine.theApp.securityTokenManager = new SecurityTokenManager();
            Engine.theApp.securityTokenManager.init();

            // Initialize the HttpClient
            try {
                Engine.logEngine.debug("HttpClient initializing...");

                Engine.theApp.httpClient = HttpUtils.makeHttpClient3(true);
                Engine.theApp.httpClient4 = HttpUtils.makeHttpClient4(true);

                Engine.logEngine.debug("HttpClient initialized!");
            } catch (Exception e) {
                Engine.logEngine.error("Unable to initialize the HttpClient.", e);
            }

            // Initialization of the schedule manager
            Engine.theApp.schedulerManager = new SchedulerManager(true);

            // Initialization of the RSA manager
            Engine.theApp.rsaManager = new RsaManager();
            Engine.theApp.rsaManager.init();

            // Initialization of the External Browser manager
            /** #3437 : Disabled ExternalBrowser feature because it's not terminated
            Engine.theApp.externalBrowserManager = new ExternalBrowserManager();
            Engine.theApp.externalBrowserManager.init();
            */

            // Initialization of the Schema manager
            Engine.theApp.schemaManager = new SchemaManager();
            Engine.theApp.schemaManager.init();

            // XUL initialization
            String xulrunner_url = System.getProperty("org.eclipse.swt.browser.XULRunnerPath");
            if (xulrunner_url == null || xulrunner_url.equals("")) {
                xulrunner_url = EnginePropertiesManager.getProperty(PropertyName.XULRUNNER_URL);
            }

            File f = new File(xulrunner_url);
            if (f.exists()) {
                xulrunner_url = f.getAbsolutePath();
                Engine.logEngine
                        .debug("initMozillaSWT: org.eclipse.swt.browser.XULRunnerPath=" + xulrunner_url);
                System.setProperty("org.eclipse.swt.browser.XULRunnerPath", xulrunner_url);
            } else {
                Engine.logEngine.error("Error in initMozillaSWT: " + xulrunner_url
                        + " doesn't exist, fix it with xulrunner.url");
            }

            if (Engine.isEngineMode() && Engine.isLinux()
                    && "true".equals(EnginePropertiesManager.getProperty(PropertyName.LINUX_LAUNCH_XVNC))) {

                Engine.logEngine
                        .debug("initMozillaSWT: org.eclipse.swt.browser.XULRunnerPath=" + xulrunner_url);
                final String display = System.getenv("DISPLAY");
                if (display != null) {
                    try {
                        String port = System.getProperty("xvnc.port");
                        if (port == null) {
                            port = "" + (Integer.parseInt(display.replaceAll(".*:(\\d*)", "$1")) + 5900);
                            System.setProperty("xvnc.port", port);
                        }
                        Engine.logEngine.debug("Xvnc should listen on " + port + " port");
                    } catch (Exception e) {
                    }
                    try {
                        File vncDir = new File(Engine.WEBAPP_PATH + "/WEB-INF/xvnc");
                        File Xvnc = new File(vncDir, "/Xvnc");
                        File fonts = new File(vncDir, "/fonts");
                        File wm = new File(vncDir, "/matchbox-window-manager");
                        if (vncDir.exists() && Xvnc.exists() && fonts.exists() && wm.exists()) {
                            for (File file : GenericUtils.<File>asList(Xvnc, wm)) {
                                new ProcessBuilder("/bin/chmod", "u+x", file.getAbsolutePath()).start()
                                        .waitFor();
                            }
                            String depth = EnginePropertiesManager.getProperty(PropertyName.LINUX_XVNC_DEPTH);
                            String geometry = EnginePropertiesManager
                                    .getProperty(PropertyName.LINUX_XVNC_GEOMETRY);
                            Engine.logEngine
                                    .debug("Xvnc will use depth " + depth + " and geometry " + geometry);
                            Process pr_xvnc = new ProcessBuilder(Xvnc.getAbsolutePath(), display, "-fp",
                                    fonts.getAbsolutePath(), "-depth", depth, "-geometry", geometry).start();
                            Thread.sleep(500);
                            try {
                                int exit = pr_xvnc.exitValue();
                                InputStream err = pr_xvnc.getErrorStream();
                                byte[] buf = new byte[err.available()];
                                err.read(buf);
                                Engine.logEngine.debug("Xvnc failed to run with exit code " + exit
                                        + " and this error : <<" + new String(buf, "UTF-8") + ">>");
                            } catch (Exception e) {
                                new ProcessBuilder(wm.getAbsolutePath()).start();
                                Engine.logEngine.debug("Xvnc successfully started !");
                            }
                        } else {
                            Engine.logEngine.info(
                                    vncDir.getAbsolutePath() + " not found or incomplet, cannot start Xvnc");
                        }
                    } catch (Exception e) {
                        Engine.logEngine.info("failed to launch Xvnc (maybe already launched", e);
                    }
                } else
                    Engine.logEngine
                            .warn("Trying to start Xvnc on Linux without DISPLAY environment variable !");
            }

            // SAP provider registration
            try {
                SapJcoDestinationDataProvider.init();
                Engine.logEngine.debug("SAP destination provider successfully registered");
            } catch (Throwable e) {
                Engine.logEngine.error("Error while registering SAP destination provider", e);
            }

            isStarted = true;

            Engine.logEngine.info("Convertigo engine started");
        } catch (Throwable e) {
            isStartFailed = true;
            Engine.logEngine.error("Unable to successfully start the engine.", e);
        }
    } else {
        Engine.logEngine.info("Convertigo engine already started");
    }
}