Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error initializing classpath: No subject alternative DNS name matching services.gradle.org found. -> when running grails 3.0.1 app

I created and ran a grails 3.0.1 app at work, but am unable to run it on my personal computer. I followed the same method of installation for grails 3.0.1 (via gvm). The problem seems to be with gradle as grails create-app worked fine. I am also able to compile the application with gradle assemble, but cannot run the application. I am using gradle 2.3.

The complete error looks as follows:

Error Error initializing classpath: No subject alternative DNS name matching services.gradle.org found.
java.security.cert.CertificateException: No subject alternative DNS name matching services.gradle.org found.
    at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:191)
    at sun.security.util.HostnameChecker.match(HostnameChecker.java:93)
    at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:347)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:203)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1428)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:901)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:837)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1023)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
    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.getInputStream(HttpURLConnection.java:1301)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
    at org.gradle.wrapper.Download.download(Download.java:44)
    at org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:177)
    at org.gradle.wrapper.Install$1.call(Install.java:59)
    at org.gradle.wrapper.Install$1.call(Install.java:46)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:46)
    at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:122)
    at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:116)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
like image 999
atuladhar Avatar asked Apr 11 '15 15:04

atuladhar


2 Answers

gradle/wrapper/gradle-wrapper.properties Change this:

-from: distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip

-to: distributionUrl=http://services.gradle.org/distributions/gradle-2.3-all.zip

like image 90
Leonid Veremchuk Avatar answered Nov 12 '22 13:11

Leonid Veremchuk


It seems that https://services.gradle.org/'s certificate is messed up

As a temporary workaround you can download the gradle wrapper via http instead of https. For this you have to modify your grails wrapper configuration. I edited build.gradle

task wrapper(type: Wrapper) {
    gradleVersion = gradleWrapperVersion
    distributionUrl = 'http://services.gradle.org/distributions/gradle-2.3-bin.zip'
}

Then generated it by issuing the command: gradle wrapper

After this grails run-app should work.

like image 25
Tegi Avatar answered Nov 12 '22 13:11

Tegi