domingo, 21 de fevereiro de 2016

handshake_failure paypal

Opa :D

Rodando meu client Java para obter o token do paypal, obtive o seguinte erro:

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at snippet.PaypalToken.main(PaypalToken.java:31)

Pra resolver, é necessário passar esse parâmetro pra JVM:
-Dhttps.protocols=TLSv1.1,TLSv1.2

No eclipse, vai em "Run configurations"


Acessa a aba "Arguments"

Em VM Arguments, coloque "-Dhttps.protocols=TLSv1.1,TLSv1.2" sem as aspas

Pronto, ao rodar novamente funcionará

Fonte: http://stackoverflow.com/questions/34963083/paypal-sandbox-api-javax-net-ssl-sslhandshakeexception-received-fatal-alert-h

Abraço!!
Adriano Schmidt

Nenhum comentário:

Postar um comentário