Dinu Nicolae
Dinu Nicolae

Reputation: 1301

How to solve java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+?

I get the error below every time I try to run a project. I did set the Project SDK to java 8, tried open jdk as well as oracle jdk, but still I get the error below. I worked with this project before and had no problems, but it does not run on my new computer. On this machine I had java 11 installed before, but I deleted it. I am using a mac.

Does anyone know why I get this error?

Thank You in Advance.

enter image description here

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getClientHttpRequestFactory' defined in class path resource [com/vocalink/bps/reporting/config/RestTemplateConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.client.ClientHttpRequestFactory]: Factory method 'getClientHttpRequestFactory' threw exception; nested exception is java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+

Upvotes: 2

Views: 7190

Answers (2)

Yuri Schimke
Yuri Schimke

Reputation: 13488

It's the same answer as here https://stackoverflow.com/a/63792370/1542667

You are using a long deprecated method that can't be cleanly supported across a range of JVM versions.

Upvotes: 1

Dinu Nicolae
Dinu Nicolae

Reputation: 1301

The problem is in the jdk version. There are 2 solutions to this problem:

  1. update okhttp version;
  2. use an older jdk (used 1.8.0_202 and it worked).

Upvotes: 1

Related Questions