gpt4 book ai didi

karate - 如何使用 Karate 跳过 SSL 证书验证?

转载 作者:行者123 更新时间:2023-12-04 22:42:09 26 4
gpt4 key购买 nike

我正在尝试通过 Karate 关闭 SSL 证书验证。现在我收到错误:

       13:27:14.668 [main] ERROR com.intuit.karate - javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, http call failed after 133 milliseconds for URL: https://VRNV02AS04294.int.carlsonwagonlit.com:8443/admin/property/filters/APFilter/true
13:27:14.668 [main] ERROR com.intuit.karate - http request failed:

javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

最佳答案

请这样做:

* configure ssl = true
阅读文档了解更多信息: https://github.com/intuit/karate#configure
编辑:对于那些将来登陆这里的人(并且在 Karate 版本 < 1.0 上),我最近意识到如果上述失败,很可能您已将 Karate 添加到具有不同版本的 Java Maven(或 Gradle)项目中范围内的 Apache HTTP 客户端库。发生的情况是 JAR 冲突导致某些 SSL 相关类无法加载。
有2个解决方案:
  • 使用 karate-jersey 而不是 karate-apache
  • 像这样强制 Apache 依赖项的版本:
  •     <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>${apache.version}</version>
    </dependency>
    apache.version 的值取决于您的项目需要什么以及 Karate 依赖什么,在大多数情况下,使用 latest possible version会工作。

    关于karate - 如何使用 Karate 跳过 SSL 证书验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67884504/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com