代码之家  ›  专栏  ›  技术社区  ›  Otto

通过jdbc连接到自签名证书opensearch服务器

  •  0
  • Otto  · 技术社区  · 1 年前

    我正在尝试连接到开发opensearch服务器。服务器具有自签名证书。

    根据我尝试连接此url的文档:

    jdbc:opensearch://https://dev01.sandbox.corp:9200/?hostnameVerification=false

    但这给了我这个错误:

    Connection error javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
          unable to find valid certification path to requested target
          unable to find valid certification path to requested target
    

    我如何使此连接正常工作?

    1 回复  |  直到 1 年前
        1
  •  0
  •   Otto    1 年前

    添加 trustSelfSigned=true param成功了。

    所以Url看起来像这样:

    jdbc:opensearch://https://dev01.sandbox.corp:9200/?hostnameVerification=false&trustSelfSigned=true