无法将类型InternalHttpClient强制转换为类型AbstractHttpClien

时间:2018-10-22 05:46:13

标签: tomcat httpclient axis2 axis apache-httpclient-4.x

获取异常:

  

org.apache.http.impl.client.InternalHttpClient无法转换为org.apache.http.impl.client.AbstractHttpClient

如何解决此异常?

我正在使用httpclient4.5和axis2 1.7.8 jar

KeyStore trustStore = MyConnector.createKeyStore(handler.getProperty("SSLTrustStoreRemoteConnector")); /
KeyStore keyStore = MyConnector.createKeyStore(handler.getProperty("SSLKeyStoreRemoteConnector"));
char[] pasw = handler.getProperty("SSLKeyStorePasswordRemoteConnector", "").toCharArray();

SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore,pasw)
    .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
    .build();

SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
    sslcontext,
    new String[] { "TLSv1" },
    null,
    SSLConnectionSocketFactory.getDefaultHostnameVerifier());

HttpClient httpclient = HttpClientBuilder.create()
    .setSSLSocketFactory(sslsf)
    .build();

requetMessageContext
    .getConfigurationContext()
    .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, (AbstractHttpClient)httpclient);

axisConfig
    .getTransportOut(Constants.TRANSPORT_HTTPS)
    .setSender(new HTTPClient4TransportSender());

我们正在使用的代码上方,并且它的代码流从httpclient4.5 jar到axis2 1.7.8 jar

0 个答案:

没有答案