0
我是Jboss的新手,並且在我的jboss代碼中使用rest rest easy client進行連接。下面是代碼 -如何繞過JBOSS中的SSL證書問題REST ClientRequest
---
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狀態500 - org.jboss.resteasy.spi.UnhandledException:javax.net.ssl.SSLException:主機名的證書沒」不匹配「。
我們目前無法更換證書,但有什麼方法可以信任任何證書?我搜索了很多帖子,但沒有任何幫助。
任何人都可以告訴我什麼是這個問題的解決方案。
我得到了解決 –