java – javax.net.ssl.SSLException: Received fatal alert: protocol_version
java – javax.net.ssl.SSLException: Received fatal alert: protocol_version
On Java 1.8 default TLS protocol is v1.2. On Java 1.6 and 1.7 default is obsoleted TLS1.0. I get this error on Java 1.8, because url use old TLS1.0 (like Your – You see ClientHello, TLSv1
). To resolve this error You need to use override defaults for Java 1.8.
System.setProperty(https.protocols, TLSv1);
More info on the Oracle blog:Diagnosing TLS, SSL, and HTTPS.
mariooshs answer seems to on the right track. It didnt work for me.
So I found:
Problems connecting via HTTPS/SSL through own Java client
which uses:
java.lang.System.setProperty(https.protocols, TLSv1,TLSv1.1,TLSv1.2);
Which seems to be necessary with Java 7 and a TLSv1.2 site.
I checked the site with:
openssl s_client -connect www.st.nmfs.noaa.gov:443
using
openssl version
OpenSSL 1.0.2l 25 May 2017
and got the result:
...
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
...
Please note that and older openssl version on my mac did not work and I had to use the macports one.
java – javax.net.ssl.SSLException: Received fatal alert: protocol_version
I ran into this issue while trying to install a PySpark package. I got around the issue by changing the TLS version with an environment variable:
echo export JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1.2 >> ~/.bashrc
source ~/.bashrc