users@jersey.java.net

[Jersey] Re: Unable to work on Jersey Client with https

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Fri, 18 Nov 2011 16:59:21 +0100

Apart from upgrading Jersey as suggested by others on the list,
you might also want to see the security part of Jersey user guide [1].

Detailed information on some related configuration settings could
be found in the https Jersey example [2].

HTH,

~Jakub

[1]http://jersey.java.net/nonav/documentation/latest/user-guide.html#d4e772
[2]http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/https-clientserver-grizzly/1.11-b01/https-clientserver-grizzly-1.11-b01-project.zip

On 15.11.2011 12:53, indhums2011 wrote:
> Hi,
>
> I am completely new to REST technology. I have to create a REST client which
> interacts with a secure server by sending and receving request and
> responses. The goal of this application is to send request and get response
> as xml/json. I am using Jersey client for creating client. It works
> successfully when I used http://.....
> When https://... is used Client Handler Exceptionwhen the following
> statement executed .
>
> Exception :com.sun.jersey.api.client.ClientHandlerException:
> javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:128)
> at com.sun.jersey.api.client.Client.handle(Client.java:569)
> at com.sun.jersey.api.client.WebResource.handle(WebResource.java:556)
> at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:69)
> at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:451)
> at com.vanilla.sample.RestService.login(CareGiver.java:151)
> at com.vanilla.sample.RestService.main(CareGiver.java:52)
> Caused by: javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
> at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
> at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1774)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)
> at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
> at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
> at
> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
> at
> sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:215)
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
> ... 6 more
>
>
> Can anyone help me....
>
> Thanks in advance
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Unable-to-work-on-Jersey-Client-with-https-tp6996013p6996013.html
> Sent from the Jersey mailing list archive at Nabble.com.
>