1

我正在使用 CXF 开发 REST Web 服务。我有一个使用证书接受 SSL 连接的 apache。

我想用org.apache.cxf.jaxrs.client.WebClient类测试我的代码,但我无法与 apache 通信,因为:

javax.net.ssl.SSLException: java.lang.IllegalArgumentException:
SSLv2Hello   cannot be enabled unless at least one other supported
version is also enabled.

我尝试像这样配置 HttpConduit:

TLSClientParameters tlsParams = new TLSClientParameters();
KeyStore trustStore = KeyStore.getInstance(KEYSTORE_TYPE);
InputStream inputStream = WesRctAbstractTestcase.class.getClassLoader().getResourceAsStream(KEYSTORE_PATH);
trustStore.load(inputStream, KEYSTORE_PASSWORD.toCharArray());
TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(trustStore);
TrustManager[] tms = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tms);
tlsParams.setSecureSocketProtocol("SSL");
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);

我不明白缺少什么。

4

0 回答 0