Uploaded image for project: 'OpenJDK'
  1. OpenJDK
  2. OPENJDK-487

cacerts in Red Hat OpenJDK 8 is symlink instead of file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 8.0.302.GA
    • None
    • None
    • False
    • False

      Red Hat OpenJDK 1.8.0.302 JDK for Linux 64 Bit contains jre/lib/security/cacerts which is symlink to /etc/pki/ca-trust/extracted/java/cacerts. This symlink is broken if cacerts is not available on the symlink location. It should rather use Java KeyStore for cacerts instead of symlink. This works fine with Red Hat OpenJDK 11 which uses Java KeyStore for jre/lib/security/cacerts.

      We used the tar.xz file from https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=core.service.openjdk&version=1.8.0.302

      We hit this issue during Red Hat OpenJDK certification for Hazelcast.

      The issue means for example that code new BufferedInputStream(new URL("https://repo1.maven.org/maven2/").openStream()); throws:

      Exception in thread "main" javax.net.ssl.SSLException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      	at sun.security.ssl.Alert.createSSLException(Alert.java:133)
      	at sun.security.ssl.TransportContext.fatal(TransportContext.java:324)
      	at sun.security.ssl.TransportContext.fatal(TransportContext.java:267)
      	at sun.security.ssl.TransportContext.fatal(TransportContext.java:262)
      	at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1563)
      	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:441)
      	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
      	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197)
      	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
      	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
      	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
      	at java.net.URL.openStream(URL.java:1068)
      	at com.mycompany.Main.main(Main.java:13)
      Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      	at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:104)
      	at sun.security.validator.Validator.getInstance(Validator.java:181)
      	at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:302)
      	at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:176)
      	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:189)
      	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
      	at sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:638)
      	at sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
      	at sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
      	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
      	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
      	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
      	at sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
      	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:152)
      	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1392)
      	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1300)
      	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435)
      	... 7 more
      Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      	at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
      	at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
      	at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
      	at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:102)

              jvanek@redhat.com Jiri Vanek
              xondrejlukas@gmail.com Ondrej Lukas (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: