我一直在尝试连接到启用SSL的2种方式的服务端点。我正在使用Spring resttemplate。我已在密钥库中添加了证书,但出现以下错误:
$('#example').tooltip({ boundary: 'window' })
相同的代码可以在我的DEV服务器上使用相同的实现正常工作,但是不能在UAT服务器上运行,但是在UAT服务器上,同一端点上的REST调用可以正常工作(也启用了2种SSL)。以下是我用于SOAP和REST调用的代码: REST:
>org.springframework.web.client.ResourceAccessException: I/O error on POST request for "path":Received fatal alert: handshake_failure; nested exception is javax.net.ssl.SSLException: Received fatal alert: handshake_failure
I enabled the SSL debus logs and in the logs I can see the warning as well:
<BEA-000000> <Warning: no suitable certificate found - continuing without client authentication>
SOAP:
ObjectMapper mapper = new ObjectMapper();
ServReqRespLogMgr reqRespLogMgr = (ServReqRespLogMgr)UtilityMgr.getBean("servReqRespLogMgr");
SSLContext sc = SSLContext.getInstance(StringUtils.trimToEmpty(PropertyUtil.getProperty("SSL_CONTEXT")));
PasswordEncryptor pe = new PasswordEncryptor();
KeyManagerFactory factory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(new FileInputStream(PropertyUtil.getProperty("JKS_LOC_VALUE")), pe.decrypt(PropertyUtil.getProperty(IConstants.JKS_PWD_VALUE)).toCharArray());
factory.init(keyStore, pe.decrypt(PropertyUtil.getProperty(IConstants.JKS_PWD_VALUE)).toCharArray());
sc.init(factory.getKeyManagers(), null, null);
CloseableHttpClient httpClient = HttpClients.custom().setSSLContext(sc).build();
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
RestTemplate restTemplate = new RestTemplate(requestFactory);
HttpHeaders headers = new HttpHeaders();
我检查了对密钥库文件的许可,看起来不错。如果我切换到SSL端点的一种方式,那么它也可以正常工作。我的Java运行时间为1.8.0_144,而我的应用服务器为WebLogic 12.2.1.3。
有人可以帮我吗?
答案 0 :(得分:0)
以下是您需要检查的几件事。
这绝对可以解决您的问题。