Retrofit: OkHttp 3.x fails with Java 8u252

Created on 23 Apr 2020  路  4Comments  路  Source: square/retrofit

Updating from Amazon Corretto 8u242 to 8u252 I'm getting this error:

java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+
    at okhttp3.internal.platform.Jdk9Platform.trustManager(Jdk9Platform.java:77)
    at okhttp3.internal.platform.Platform.buildCertificateChainCleaner(Platform.java:177)
    at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:743)
    at com.spectralogic.blackpearl.management.network.RetroFitBuilder.build(RetroFitBuilder.java:71)

I'm using the lastest retrofit version 2.8.1.

Reading online this seems to be a known issue with OkHttp and it looks like the issue is fixed with OkHttps >4.3.0

Please let me know if more info is needed.

Bug OkHttp

Most helpful comment

This shipped in Retrofit 2.8.2.

All 4 comments

This is tracked at https://github.com/square/okhttp/issues/5970. No action on our side until there's an OkHttp 3.14 release to fix it.

If you can use OkHttp 4, please do!

@shabtaisharon Also worth calling out that it needs a fix in Coretto also. This UnsupportedOperationException is basically saying that they no longer support ALPN therefore HTTP/2.

alpn-boot is explicitly not supported from 252 onwards.

So with the "fix" in 3.14.x is that you'll get plain old HTTP/1.1.

I've updated my OkHttp to 4.5.0 and everything seems to work, thanks!

This shipped in Retrofit 2.8.2.

Was this page helpful?
0 / 5 - 0 ratings