com.sun.jersey.api.client.ClientHandlerException:javax.net.ssl.SSLException:收到致命警报:handshake_failure

时间:2019-02-17 07:59:58

标签: java web-services ssl weblogic two-way

任何人都已经使用Jersey客户端完成了两种方法的ssl身份验证。

使用jersey客户端使用Rest Webservice时,出现以下错误。我们已经在Weblogic节点级别和jre'cacerts'中导入了SSL。

我是否需要编写任何专门用于认证SSL的代码?

snippet:
Response response = client
                    .target("https://example.com")
                    .request()
                    .header("X-IBM-Client-Id","a30c2d5d-bb2d-40e3-a073-6472e72e06bd")
                    .header("X-IBM-Client-Secret", "Q2uC4wC6rX2sQ6aU3oV7iL2iF8vI8oM8lT1tK0dW6yV3oG5yL0")
                    .header("Authorization", "Basic " + "dGVzdGNsaWVudDpPeFljb29sQDEyMw==")
                    .header("Content-Type", "application/json")
                    .post(Entity.entity(json, MediaType.APPLICATION_JSON), Response.class);

com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLException: Received fatal alert: handshake_failure
        at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)

        at com.sun.jersey.api.client.Client.handle(Client.java:652)

        at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)

        at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)

        at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)

        at com.edelweiss.client.TransferFund.transferFund(Unknown Source)

        at com.edelweiss.client.TransferFund.run(Unknown Source)

        at com.edelweiss.client.TransferRunnable.run(Unknown Source)

        at com.edelweiss.client.TransferRunnable.call(Unknown Source)

        at com.edelweiss.client.TransferRunnable.call(Unknown Source)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:748)

Caused by: javax.net.ssl.SSLException: Received fatal alert: handshake_failure

        at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)

        at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1666)

        at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1634)

        at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1800)

        at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1083)

        at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:907)

        at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)

        at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:664)

        at weblogic.security.SSL.jsseadapter.JaSSLEngine$5.run(JaSSLEngine.java:135)

        at weblogic.security.SSL.jsseadapter.JaSSLEngine.doAction(JaSSLEngine.java:743) 

0 个答案:

没有答案