【发布时间】:2016-06-13 10:03:18
【问题描述】:
我是 Jboss 的新手,在我的 jboss 代码中使用 rest easy 客户端进行连接。下面是代码-
---
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
---
public String login() throws Exception {
---
String URL = "https://IP//service/perform.do?operationId=XXXXX";
ClientRequest restClient = new ClientRequest(URL);
restClient.accept(MediaType.APPLICATION_JSON);
restClient.body(MediaType.APPLICATION_JSON, hmap);
ClientResponse < String > resp = restClient.post(String.class);
if (resp.getStatus() != 201) {
throw new RuntimeException("Failed : HTTPS error code : " + resp.getStatus());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
new ByteArrayInputStream(resp.getEntity().getBytes())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
return output;
}
与启用 SSL 的服务器连接时,出现证书错误“HTTP Status 500 - org.jboss.resteasy.spi.UnhandledException: javax.net.ssl.SSLException: hostname in certificate didn't match”。
我们目前无法更改证书,但是有什么方法可以信任任何证书吗?我用谷歌搜索了很多帖子,但没有任何帮助。
任何人都可以告诉我这个问题的解决方案是什么。
【问题讨论】:
-
我得到了解决方案
标签: eclipse ssl-certificate jboss7.x resteasy