Skip to content Skip to sidebar Skip to footer

Javax.net.ssl.SSLProtocolException: SSL Handshake Aborted: Ssl=0x7fa2258640: Failure In SSL Library, Usually A Protocol Error

I am trying a demo Android app to connect servlet (both local server and aws instance) it gives Handshake failed error. I have tried with volley and http client also. The relevant

Solution 1:

URL url = new URL("https://192.168.0.7:9999/WebS/welcome/test");

This url contains also the port specification (port 9999). Make sure your SSL server instance (HTTPS protocol) is configured to listen at that port, maybe you are by mistake connecting to the non-SSL instance of your server (HTTP protocol).

Try for example insecure URL url = new URL("http://192.168.0.7:9999/WebS/welcome/test"); to see if the communication works with HTTP protocol on that address. If yes, then you need to connect to different port for HTTPS. The easiest bet is to try first with default SSL port (443), i.e. just remove the port number: URL url = new URL("https://192.168.0.7/WebS/welcome/test");

You can also try all these varianst of url in your favourite browser to see what it does think about it (I'm using personally firefox, the url with port pointing to HTTP did produce weird errors about wrong certificate length, etc... once I fixed my url to point to the HTTPS instance, the firefox did report only insecure connection due to self-signed certificate used, which was expected and understandable.

The correct HTTPS url, without further extra configuration of mobile app, will probably fail with javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. - if you are using self-signed certificate for your local server. Which is different problem and there's lot of documentation how to deal with that (and overall how to pin certificates, check domain names and create secure connection).

But the WRONG_VERSION_NUMBER (external/boringssl/src/ssl/tls_record.c: suggest you are connecting by accident to the unencrypted HTTP instance of your server, then the SSL handshake is completely confused.


Solution 2:

I had the same issue and I was able to solve it by removing 's' from the url.

Please change the url to

URL url = new URL("http://192.168.0.7:9999/WebS/welcome/test");

Post a Comment for "Javax.net.ssl.SSLProtocolException: SSL Handshake Aborted: Ssl=0x7fa2258640: Failure In SSL Library, Usually A Protocol Error"