sten
sten

Reputation: 7486

Eclipse : clientBuilder.sslSocketFactory not supported on JDK 9+

I'm getting this error on Eclipse oxygen 4.7.0, java 1.8

clientBuilder.sslSocketFactory not supported on JDK 9+

related to Eclipse, maven ..trying to update Maven : Alt+f5 the module okhttp3 trying to connect .. when resolving/processing pom

I dont have JDK9 at all. Looked at all the other similar reports on stackoverflow, none is related.

Upvotes: 8

Views: 29957

Answers (6)

user3729220
user3729220

Reputation: 250

There are two versions of Java 8 as below:

  1. Java SE 8 (8u211 and later)
  2. Java SE 8 (8u202 and earlier)

So if you have installed "Java SE 8 (8u211 and later)" you will receive error: clientBuilder.sslSocketFactory not supported on JDK 9+ in eclipse oxygen. To avoid this error please install "Java SE 8 (8u202 and earlier)" from below link https://www.oracle.com/java/technologies/downloads/archive/

Upvotes: 2

Pratik Garg
Pratik Garg

Reputation: 171

I followed these steps to remove this error: Earlier Code:

OkHttpClient.Builder builder = new OkHttpClient.Builder(); 
 builder.sslSocketFactory(sslSocketFactory);

New Code:

OkHttpClient.Builder builder = new OkHttpClient.Builder(); 
 X509TrustManager trustManager = new X509DeployTrustManager();
 builder.sslSocketFactory(sslSocketFactory);

Upvotes: 1

dallaslu
dallaslu

Reputation: 522

Check your OkHttpClient.Builder(), change code from

sslSocketFactory(SSLSocketFactory sslSocketFactory)

to

sslSocketFactory(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager)

For example:

// define sslContext ...

new OkHttpClient.Builder().sslSocketFactory(sslContext.getSocketFactory(), new JEEX509TrustManager()).build();

And then everything will be ok.

Upvotes: 2

Mehul Goel
Mehul Goel

Reputation: 27

If anyone has come to face this issue when running Azul's zulu8 open jdk, try by taking zulu8 jdk of say 3-4 versions behind the latest. That worked for me.

Upvotes: 1

Anish B.
Anish B.

Reputation: 16539

I think you are running Eclipse Oxygen with JDK 9.

If you don't want to, then I have a solution for that.

Update the eclipse/eclipse.ini by adding -vm parameter:

-startup
plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.700.v20180518-1200
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:/Program Files/Java/jdk1.8.0_251/bin
-vmargs
-Dosgi.requiredJavaVersion=1.8
[email protected]/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM

This .ini file is from my latest eclipse. It may be different for other versions.

This will enforce eclipse to start with the JDK that you have added.

Note: -Dosgi.requiredJavaVersion=1.8 will give you information upto which java version the eclipse can support.

Upvotes: 6

VonC
VonC

Reputation: 1327384

You can find a similar issue in Eclipse bug 517113, with JDK8.

The error call stack indicates an external dependencies to a library compiled with OpenJDK

As seen here, check also your JDK declaration in your Eclipse

I changed code which was using JAVA_HOME as JRE coming with SonarScanner package.
Once I changed it to default JAVA_HOME, it started working fine.

Other possible cause: wrong dependency, as show by PR 3066 or this question.

Upvotes: 6

Related Questions