0

I am trying to run mvn install from command prompt I am getting the below exception.

        Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.Validator
        Exception: PKIX path building failed: sun.security.provider.certpath.SunCertPath
        BuilderException: 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:1836)
                at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
                at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
                at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
        java:1337)
                at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.jav
        a:154)
                at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
                at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
                at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:966)
                at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.
        java:1262)
                at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1289
        )
                at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1273
        )
                at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnecti
        onSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:280)
                at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClient
        ConnectionOperator.upgrade(HttpClientConnectionOperator.java:167)
                at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHtt
        pClientConnectionManager.upgrade(PoolingHttpClientConnectionManager.java:329)
                at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
        lientExec.establishRoute(MainClientExec.java:392)
                at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
        lientExec.execute(MainClientExec.java:218)
                at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Proto
        colExec.execute(ProtocolExec.java:194)
                at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Retry
        Exec.execute(RetryExec.java:85)
                at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Redir
        ectExec.execute(RedirectExec.java:108)
                at org.apache.maven.wagon.providers.http.httpclient.impl.client.Internal
        HttpClient.doExecute(InternalHttpClient.java:186)
                at org.apache.maven.wagon.providers.http.httpclient.impl.client.Closeabl
        eHttpClient.execute(CloseableHttpClient.java:82)
                at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute
        (AbstractHttpClientWagon.java:756)
                at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
        utData(AbstractHttpClientWagon.java:854)
                ... 8 more
        Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
         sun.security.provider.certpath.SunCertPathBuilderException: unable to find vali
        d certification path to requested target
                at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
                at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.jav
        a:292)
                at sun.security.validator.Validator.validate(Validator.java:260)
                at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.j
        ava:326)
                at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerIm
        pl.java:231)
                at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustMan
        agerImpl.java:126)
                at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.
        java:1319)
                ... 27 more
        Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to
         find valid certification path to requested target
                at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCert
        PathBuilder.java:196)
                at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
                at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
                ... 33 more

When I try to run mvn clean it is working properly.

I try to figure it out with google, that the above error is caused by certification error.

I download the InstallCert.java file and runned it and copy pasted the file into the "C:\Program Files\Java\jdk1.7.0\bin"

But still am getting the certification error.

Am I doing anything wrong?

Chiragkumar Thakar
  • 3,616
  • 5
  • 37
  • 49
bharathi
  • 6,019
  • 23
  • 90
  • 152

2 Answers2

0

I found out that you need to enable the server setting in the settings.xml file.

For example:

<server>
  <id>deploymentRepo</id>
  <username>****</username>
  <password>****</password>
</server>

This allowed me to overcome the SSL certificate error.

Serlite
  • 12,130
  • 5
  • 38
  • 49
bharathi
  • 6,019
  • 23
  • 90
  • 152
-1

solution downloading root ca ssl certificate and install it into cacerts file of your jre which is used by maven!Checkout this full answer it is quite descriptive.

Community
  • 1
  • 1
positivecrux
  • 1,307
  • 2
  • 16
  • 35