Eclipse : clientBuilder.sslSocketFactory not supported on JDK 9+

左心房为你撑大大i 提交于 2020-12-29 12:10:37

问题


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.


回答1:


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.




回答2:


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
-Dosgi.instance.area.default=@user.home/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.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/61899113/eclipse-clientbuilder-sslsocketfactory-not-supported-on-jdk-9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!