{"record":{"id":"68f7962097bf8be5","repo":"prestodb/presto","slug":"failed-to-initialize-sslcontext","errorCode":null,"errorMessage":"Failed to initialize SSLContext","messagePattern":"Failed to initialize SSLContext","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"presto-redis/src/main/java/com/facebook/presto/redis/RedisJedisManager.java","lineNumber":134,"sourceCode":"     * Creates SSLContext initialized with the given truststore.\n     */\n    private SSLContext createSslContext(KeyStore trustStore)\n    {\n        if (trustStore == null) {\n            throw new IllegalStateException(\"Truststore must not be null for TLS connections\");\n        }\n\n        try {\n            TrustManagerFactory tmf = TrustManagerFactory.getInstance(getDefaultAlgorithm());\n            tmf.init(trustStore);\n\n            SSLContext sslContext = SSLContext.getInstance(TLS_PROTOCOL);\n            sslContext.init(null, tmf.getTrustManagers(), null);\n\n            return sslContext;\n        }\n        catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {\n            throw new RuntimeException(\"Failed to initialize SSLContext\", e);\n        }\n    }\n\n    private JedisPoolConfig createJedisPoolConfig()\n    {\n        JedisPoolConfig config = new JedisPoolConfig();\n        config.setMinIdle(JEDIS_MIN_IDLE_CONNECTIONS);\n        config.setMaxTotal(JEDIS_MAX_IDLE_CONNECTIONS);\n        return config;\n    }\n\n    /**\n     * Loads the truststore containing Redis server certificate.\n     * Returns null if truststore path is not configured.\n     */\n    private KeyStore loadTrustStore()\n    {\n        if (redisConnectorConfig.getTruststorePath() == null) {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-redis/src/main/java/com/facebook/presto/redis/RedisJedisManager.java#L116-L152","documentation":"After initializing the TrustManagerFactory, createSslContext calls SSLContext.getInstance(TLS_PROTOCOL) and init(); SSL/TLS APIs throw NoSuchAlgorithmException, KeyStoreException, or KeyManagementException, which are wrapped in a RuntimeException 'Failed to initialize SSLContext'. It indicates the JVM/TLS provider could not build the SSL context.","triggerScenarios":"The JVM lacks the requested TLS protocol algorithm (unusual JDK builds or old JDKs); the TrustManagerFactory produced no/invalid trust managers due to a bad truststore; KeyManagementException from invalid SSLContext init parameters.","commonSituations":"Running on a stripped or very old JDK without TLS support; security provider misconfiguration (java.security edits); corrupted JKS truststore previously loaded fine but rejected at init.","solutions":["Check the JDK version supports the TLS protocol version and includes standard security providers","Inspect the wrapped cause (e.getCause()) for the real NoSuchAlgorithmException/KeyStoreException/KeyManagementException","Verify the truststore file is a valid JKS/PKCS12 and not corrupt","Restore the default java.security provider list if it was customized"],"exampleFix":"// before: custom security providers removed TLS\n// after: restore default providers or use a supported protocol\n-Djava.security.properties=/etc/presto/java.security","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { SSLContext ctx = SSLContext.getInstance(\"TLS\"); ctx.init(null, tmf.getTrustManagers(), null); } catch (RuntimeException e) { throw new IllegalStateException(\"SSL init failed: \" + e.getCause(), e.getCause()); }","preventionTips":["Run on a JDK with standard TLS providers","Inspect e.getCause() to identify the real SSL failure","Avoid customizing java.security provider lists unnecessarily"],"tags":["redis","tls","ssl","jdk"],"backgroundTag":"sslcontext-init-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}