How do I set SSL protocol version in java? And how do I know which one? javax.net.ssl.SSLException: Received fatal alert: protocol_version

后端 未结 4 1428
执念已碎
执念已碎 2021-02-02 05:03

I am using Apache HttpClient 4.3 to interact with the API of hubic.com. My minimal reproducable example is just a one liner:

<         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-02-02 05:10

    It looks like you are not using java 1.8

    In Java 1.8 the default TLS protocol version is v1.2, whereas in Java 1.6,1.7 default is TLS1.0. As you can see in logs ClientHello, TLSv1.2 it means you are either using java 1.6 or 1.7 now you can either switch to 1.8 or Just add

    static { System.setProperty("https.protocols", "TLSv1.2"); }

    in your application class before main class keeping you current java version
    .. hope this helps !!

提交回复
热议问题