Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not send ssl message with java [duplicate]

I have setup my mac with Eclipse EE Luna and all seem to work fine (coming from Windows).

I installed EGit and the Github (Mylin) plugin.

However, I can't seem to clone a github project in Eclipse. When using the eclipse import through EGit (not the gitHub plugin), and fill in the Https uri (of any opensource github project), Egit complaints it can't connect and shows a bullet list with possible causes like Uri incorrect, etc..

When using the Eclipse Github plugin to import a github project and let the plugin search I get the famous trusted certification error:

Error searching repositories: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Strange... I have a default java 8 installation. I even added the github pub cert to the jssecert file in the sdk/jre/lib, but had no effect. I have no proxy enabled, neither in Eclipse or system.

I am able to clone a repo through the git command "git clone [https repo uri]".

How to solve this?

like image 975
edbras Avatar asked Nov 18 '22 13:11

edbras


1 Answers

This should be a comment, but for some stupid reason i need to have a reputation to make a comment...

Same problem here.

My git server have a self-signed certificate.

The certificate name (CN) have the same name as the hostname i use to connect to it.

I had put the configuration property "http.sslVerify=false" in .gitconfig.

When i try to clone (using https), Eclipse connects to the repository, gets the repository information, shows the "master" branch, starts to clone (it shows the progress bar), receive the objects, but throws an Exception at the end (exception below), and didn't clone the repository (see the images below).

There is probably a bug here, since it can read the repository to get its information and files, but cannot finish the whole process.

Environment:

eclipse.buildId=4.5.0.I20150320-0800
java.version=1.8.0_25
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pt_BR
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

Exception:

org.eclipse.core.runtime.CoreException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at org.eclipse.egit.core.op.ConfigureGerritAfterCloneTask.execute(ConfigureGerritAfterCloneTask.java:89)
    at org.eclipse.egit.core.op.CloneOperation.run(CloneOperation.java:161)
    at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard.executeCloneOperation(AbstractGitCloneWizard.java:442)
    at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard.access$2(AbstractGitCloneWizard.java:435)
    at org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard$5.run(AbstractGitCloneWizard.java:396)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1471)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:936)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:871)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at org.eclipse.egit.core.op.ConfigureGerritAfterCloneTask.isGerrit(ConfigureGerritAfterCloneTask.java:138)
    at org.eclipse.egit.core.op.ConfigureGerritAfterCloneTask.execute(ConfigureGerritAfterCloneTask.java:83)
    ... 5 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
    at sun.security.validator.Validator.validate(Validator.java:260)
    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1453)
    ... 20 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
    ... 26 more

enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

like image 190
Fabiano Avatar answered Dec 06 '22 17:12

Fabiano