如何解决-错误com.intuit.karate-HTTP请求失败

时间:2019-07-20 16:26:44

标签: karate

  1. 我已使用Springboot将mongoDb与SSL和证书(信任,密钥库)连接
System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath.getPath());
System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
System.setProperty("javax.net.ssl.keyStore", keyStoreFilePath.getPath());
System.setProperty("javax.net.ssl.keyStorePassword", keystorePassword);
  1. 然后,就可以成功连接
  2. 然后,尝试在https://xxxxxx.net/api/v1/login上进行REST调用

添加并尝试了以下选项 -karate.configure('ssl',true); -*配置ssl = true

我遇到错误-

admin_login.feature
21:43:28.106 [ForkJoinPool-1-worker-1] 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 943 milliseconds for URL: https://xxxxxx.net/api/v1/login
21:43:28.107 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - http request failed: 
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
21:43:28.114 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - feature call failed: classpath:admin_login.feature
arg: [object Object]
admin_login.feature:8 - 
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
21:43:28.116 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - javascript function call failed: 
admin_login.feature:8 - 
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
  1. 如果我没有用ssl连接数据库。能够拨打所有REST通话 请对此提供帮助。

1 个答案:

答案 0 :(得分:1)

SSL可能很棘手,您可能需要时间和耐心。

通常* configure ssl = true仅应在空手道中使用,因为它将禁用证书验证。听起来这里您已经设置了一些空手道也要拾取的系统属性。请参阅https://github.com/intuit/karate#system-properties-for-ssl-and-http-proxy

因此,也许您使用advanced form of configure ssl可以使其正常工作。

请记住,如果仍然卡住并且需要更多支持,请按照此处的说明进行操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue