I am encountering an issue with Gradle when attempting to run a task on a Linux server. Despite having the correct Java and Gradle versions configured, I am getting SSL misconfiguration errors when Gradle tries to resolve plugins. Here’s a detailed breakdown of my setup and the error:
Environment:
Gradle version: 8.8
Java version: openjdk version “1.8.0_412”
Java home: Set in /etc/profile as
**./gradlew taskname -PmlHost=“localhost” on the linux server, getting following error : **
2024-06-07T18:10:27.221+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {s}->https://plugins.gradle.org:443
2024-06-07T18:10:27.224+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to plugins.gradle.org/ip:443
2024-06-07T18:10:27.224+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to plugins.gradle.org/ip:443 with timeout 30000
> Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
> Could not get resource 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
> Could not GET 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
> Got socket exception during request. It might be caused by SSL misconfiguration
> Connect to plugins.gradle.org:443 [plugins.gradle.org/104.16.72.101, plugins.gradle.org/104.16.73.101, plugins.gradle.org/2606:4700:0:0:0:0:6810:4865, plugins.gradle.org/2606:4700:0:0:0:0:6810:4965] failed: Network is unreachable (connect failed)
However, when I use curl to check the connection, I get a 200 OK response:
and same code when I am running on my local system it is work fine
There I am using java version “1.8.0_202”
Why does Gradle fail to resolve the plugin due to an SSL misconfiguration even though curl works fine? How can I resolve this SSL misconfiguration to allow Gradle to successfully connect to the plugin repository?
Any help or insights into this issue would be greatly appreciated!
Why does Gradle fail to resolve the plugin due to an SSL misconfiguration even though curl works fine?
I don’t think it is an SSL misconfiguration.
It says “might be caused by” since 8.3.0, probably because that is a typical cause for that error.
But if you look at the actual error one line below, it says
Network is unreachable (connect failed)
That curl works is just an indication, but not a proof.
I’d guess that you need to use some proxy to access the internet, which is configured for curl, but not for Gradle. See Networking with Gradle for more info on that.
But after using proxy also in gradle.properties:
systemProp.http.proxyHost=proxy
systemProp.http.proxyPort=port
systemProp.https.proxyHost=proxy
systemProp.https.proxyPort=port
getting this error
> Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
Required by:
project : > com.github.node-gradle.node:com.github.node-gradle.node.gradle.plugin:2.2.0
> Could not resolve com.github.node-gradle:gradle-node-plugin:2.2.0.
> Could not get resource 'https://plugins.gradle.org/m2/com/github/node-gradle/gradle-node-plugin/2.2.0/gradle-node-plugin-2.2.0.pom'.
> Could not GET 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_bf4e8fee0b3de0481a0ab35044e3cd3fd85b9270fc49_IvVXbotm_'.
and in debug mode it showing like this
’
2024-06-10T13:31:36.827+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection [id: 17][route: {tls}->http://proxy:port->https://plugins.gradle.org:443] can be kept alive indefinitely
2024-06-10T13:31:36.827+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-17: set socket timeout to 0
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 17][route: {tls}->http://proxy:port->https://plugins.gradle.org:443][total available: 1; route allocated: 1 of 20; total allocated: 1 of 20]
2024-06-10T13:31:36.828+0000 [DEBUG] [org.gradle.internal.resource.transport.http.AlwaysFollowAndPreserveMethodRedirectStrategy] Redirect requested to location 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom'
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Resetting target auth state
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Redirecting to 'https://plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom' via {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
2024-06-10T13:31:36.828+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection request: [route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 1; route allocated: 0 of 20; total allocated: 1 of 20]
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection leased: [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 1; route allocated: 1 of 20; total allocated: 2 of 20]
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443
2024-06-10T13:31:36.829+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to proxy/ip:port
2024-06-10T13:31:36.842+0000 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connection established ip1:port1<->ip:port
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Tunnel to target created.
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled protocols: [TLSversion, TLSversion]
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled cipher suites:[]
2024-06-10T13:31:36.886+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Secure session established
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] negotiated protocol: TLSvversion
2024-06-10T13:31:36.922+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] negotiated cipher suite: TLS
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] peer principal: CN=plugins-artifacts.gradle.org, O="Cisco Systems, Inc."
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] peer alternative names: [plugins-artifacts.gradle.org]
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] issuer principal: CN=Cisco Umbrella
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-18: set socket timeout to 30000
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request GET /com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom HTTP/1.1
2024-06-10T13:31:36.923+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Target auth state: UNCHALLENGED
2024-06-10T13:31:36.946+0000 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection can be kept alive indefinitely
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.ResponseProcessCookies] Cookie accepted [X-OpenDNS-Session="830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB", version:0, domain:plugins-artifacts.gradle.org, path:/, expiry:Mon Jun 10 13:36:36 UTC 2024]
2024-06-10T13:31:36.947+0000 [DEBUG] [org.gradle.internal.resource.transport.http.AlwaysFollowAndPreserveMethodRedirectStrategy] Redirect requested to location 'https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com/s/plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB_'
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Resetting target auth state
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.execchain.RedirectExec] Redirecting to 'https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com/s/plugins-artifacts.gradle.org/com.github.node-gradle/gradle-node-plugin/2.2.0/8a8d8d9c9a05f28650dda340493dc23a9099e049a49ca39b15799b890ccc8f4c/gradle-node-plugin-2.2.0.pom?X-OpenDNS-Session=_830f90b506290040c7098eb0eb590c4f5a4f9270fc53_BZAQUSAB_' via {tls}->http://proxy:port->https://plugins-artifacts.gradle.org.x.830f90b506290040c7098eb0eb590c4f5a4f.9270fc53.id.opendns.com:443
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443] can be kept alive indefinitely
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-18: set socket timeout to 0
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection released: [id: 18][route: {tls}->http://proxy:port->https://plugins-artifacts.gradle.org:443][total available: 2; route allocated: 1 of 20; total allocated: 2 of 20]
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
2024-06-10T13:31:36.947+0000 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
I have checked with network team as per them proxy is properly configured. we tried to clean .gradle file then ran gradle command to install gradle wrapper, it is installing that correctly, which we do not work without proxy and also there is nothing in debug that shows connection not successful, we have gone through it and found nothing like that but in end it throwing that exception and when using wget to same url, the pom and jre file are downloaded successfully.
In our company we are using cisco umbrella, is it be the one behind it as I gone through one of discussion page on discuss.gradle.org which Download Wrapper fails with SSLHandshakeException stacktrace - #5 by DJViking.
Any insights or suggestions would be greatly appreciated.
I’m sorry, but from remote I have no idea. If you think the proxy is configured properly but it does not work, maybe it is some uncommon proxy setup that is not supported or buggy. In that case it might make sense to open an issue ticket on GitHub.
Our team is having Umbrella-related Gradle errors, and I’m not sure whether it is the same problem. Maybe this helps in diagnosing the problem:
Starting on 2024-05-31 or maybe a little earlier, we got Gradle errors like
Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/org/jetbrains/gradle/plugin/idea-ext/gradle-idea-ext/1.1.8/gradle-idea-ext-1.1.8.pom'.
> Could not GET 'https://plugins-artifacts.gradle.org/gradle.plugin.org.jetbrains.gradle.plugin.idea-ext/gradle-idea-ext/1.1.8/22c44e5c0629bccc3a12e8e2dad313ecad1e7a6071dd529ef7fa98f7aaf3abc0/gradle-idea-ext-1.1.8.pom'.
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
As a workaround, our network admins added plugins-artifacts.gradle.org to an Umbrella whitelist. That “fixed” the errors.
The admins told us to use the Umbrella root certificate, which are already installed in our systems’ certificate stores (on Windows and macOS). So for Windows, we set environment variable JAVA_TOOL_OPTIONS to -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT -Djavax.net.ssl.trustStore=NUL. (Some users put systemProp.javax.net.ssl.trustStoreType=Windows-ROOT and systemProp.javax.net.ssl.trustStore=NUL in their ~/.gradle/gradle.properties instead.)
It seems that we are succesfully using the Windows trust store, but now we get errors like
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project '…'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.8.
Required by:
project : > org.jetbrains.gradle.plugin.idea-ext:org.jetbrains.gradle.plugin.idea-ext.gradle.plugin:1.1.8
> Could not resolve gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.8.
> Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/org/jetbrains/gradle/plugin/idea-ext/gradle-idea-ext/1.1.8/gradle-idea-ext-1.1.8.pom'.
> Could not GET 'https://plugins-artifacts.gradle.org/gradle.plugin.org.jetbrains.gradle.plugin.idea-ext/gradle-idea-ext/1.1.8/22c44e5c0629bccc3a12e8e2dad313ecad1e7a6071dd529ef7fa98f7aaf3abc0/gradle-idea-ext-1.1.8.pom?X-OpenDNS-Session=_6…uw1_'.
…
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project '…'.
…
Caused by:
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
…
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.8.
Required by:
project : > org.jetbrains.gradle.plugin.idea-ext:org.jetbrains.gradle.plugin.idea-ext.gradle.plugin:1.1.8
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.8.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/org/jetbrains/gradle/plugin/idea-ext/gradle-idea-ext/1.1.8/gradle-idea-ext-1.1.8.pom'.
…
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://plugins-artifacts.gradle.org/gradle.plugin.org.jetbrains.gradle.plugin.idea-ext/gradle-idea-ext/1.1.8/22c44e5c0629bccc3a12e8e2dad313ecad1e7a6071dd529ef7fa98f7aaf3abc0/gradle-idea-ext-1.1.8.pom?X-OpenDNS-Session=_6…uw1_'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.createHttpRequestException(HttpClientHelper.java:122)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:114)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:98)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:103)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:45)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:30)
at org.gradle.internal.resource.transfer.AbstractExternalResourceAccessor.withContent(AbstractExternalResourceAccessor.java:32)
at org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.withContent(DefaultExternalResourceConnector.java:59)
at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor$DownloadOperation.call(ProgressLoggingExternalResourceAccessor.java:123)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor.withContent(ProgressLoggingExternalResourceAccessor.java:46)
at org.gradle.internal.resource.transfer.AccessorBackedExternalResource.withContentIfPresent(AccessorBackedExternalResource.java:103)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:188)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.lambda$getResource$1(DefaultCacheAwareExternalResourceAccessor.java:86)
at org.gradle.cache.internal.ProducerGuard$AdaptiveProducerGuard.guardByKey(ProducerGuard.java:97)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:80)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:149)
... 244 more
Caused by: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:199)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:175)
at org.gradle.internal.resource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.java:164)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:112)
... 266 more
Caused by: org.apache.http.client.CircularRedirectException: Circular redirect to 'https://plugins-artifacts.gradle.org/gradle.plugin.org.jetbrains.gradle.plugin.idea-ext/gradle-idea-ext/1.1.8/22c44e5c0629bccc3a12e8e2dad313ecad1e7a6071dd529ef7fa98f7aaf3abc0/gradle-idea-ext-1.1.8.pom'
at org.apache.http.impl.client.DefaultRedirectStrategy.getLocationURI(DefaultRedirectStrategy.java:193)
at org.gradle.internal.resource.transport.http.AlwaysFollowAndPreserveMethodRedirectStrategy.getRedirect(AlwaysFollowAndPreserveMethodRedirectStrategy.java:46)
at org.gradle.internal.resource.transport.http.RedirectVerifyingStrategyDecorator.getRedirect(RedirectVerifyingStrategyDecorator.java:46)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:126)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
... 271 more
In a simple test application using HttpClientBuilder.create().build() and httpClient.execute(new HttpGet(url), …) from org.apache.httpcomponents:httpclient:4.5.14, the first one throws
Caused by: org.apache.http.client.CircularRedirectException: Circular redirect to 'https://plugins-artifacts.gradle.org/gradle.plugin.org.jetbrains.gradle.plugin.idea-ext/gradle-idea-ext/1.1.8/22c44e5c0629bccc3a12e8e2dad313ecad1e7a6071dd529ef7fa98f7aaf3abc0/gradle-idea-ext-1.1.8.pom'