configureBody(request, requestData.getBody())
configureHeaders(request, requestData.getHeadersAsMap())
String keyPassphrase = "password";
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(new FileInputStream("Resources/certificates/selfsigned.jks"), keyPassphrase.toCharArray());
SSLContext sslContext = SSLContexts.custom().loadKeyMaterial(keyStore, "password").build(); //(keyStore, "password").build()
HttpClient httpClient = HttpClients.custom().setSSLContext(sslContext).build();
HttpResponse response = httpClient.execute(request, httpClientContext)
coming error:- groovy.lang.MissingMethodException: No signature of method: org.apache.http.ssl.SSLContextBuilder.loadKeyMaterial()
我正在使用httpclient4.5.5 jar。在httpclient4.4中已弃用loadkeyMaterial方法。请提出一些替代方案。
答案 0 :(得分:1)
您应该使用org.apache.http.ssl.SSLContextBuilder
中的loadKeyMaterial而不是org.apache.http.conn.ssl.SSLContextBuilder
中的fo。
因此,基本上改变您的进口商品:
// The one deprecated to be removed from your code
//import org.apache.http.conn.ssl.SSLContextBuilder;
// The good one
import org.apache.http.ssl.SSLContextBuilder;