netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

path with "!" causes org.gradle.tooling.GradleConnectionException

Open MarkHorn-web opened this issue 1 month ago • 9 comments

Apache NetBeans version

Apache NetBeans 28

What happened

I want to create a Gradle project. When I do Netbeans main menu, File -> New Project -> Java with Gradle-> Java Application [or Java Class Library] -> Next I get the following error:

org.gradle.tooling.GradleConnectionException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-9.2.1-bin.zip'.
	at org.gradle.tooling.internal.consumer.ConnectionExceptionTransformer.transform(ConnectionExceptionTransformer.java:73)
	at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:42)
	at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:68)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)
	at java.base/java.lang.Thread.run(Thread.java:1447)
	at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
	at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:82)
	at org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitStep.execute(TemplateOperation.java:385)
 etc. etc.

Two apparent problems. a. Apparently NetBeans is trying to get Gradle from the specified zip file. Why should that be necessary? Isn't Gradle built in to NetBeans already (e.g. like Ant and Maven)? b. The Gradle version (9.2.1) sought here seems to be out of date. The most recent distribution listed at services.gradle.org/distributions is 9.4.0.

Language / Project Type / NetBeans Component

Java Gradle Project

How to reproduce

In Netbeans main menu, File -> New Project -> Java with Gradle-> Java Application [or Java Class Library] -> Next

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11 version 10.0 running on amd64; UTF-8; en_AU (nb)

JDK

Java: 24.0.2; Java HotSpot(TM) 64-Bit Server VM 24.0.2+12-54 and Runtime: Java(TM) SE Runtime Environment 24.0.2+12-54

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

The problem occurs whene4ver I try to create a Gradle project.

Are you willing to submit a pull request?

No

MarkHorn-web avatar Dec 01 '25 05:12 MarkHorn-web

a. Apparently NetBeans is trying to get Gradle from the specified zip file. Why should that be necessary? Isn't Gradle built in to NetBeans already (e.g. like Ant and Maven)?

NB doesn't include the gradle distribution, only the gradle tooling API to interface with gradle.

Did you run the wizard while being disconnected from the internet?

b. The Gradle version (9.2.1) sought here seems to be out of date. The most recent distribution listed at services.gradle.org/distributions is 9.4.0.

9.2.1 is the latest release still, the other files you see on that page are release candidates or milestone builds.

if you want to use a different version, simply change the property in gradleproject1/gradle/wrapper/gradle-wrapper.properties.

mbien avatar Dec 01 '25 09:12 mbien

In reply to your question about the wizard, sorry but which wizard are you referring to? Also, could you tell me please where is gradleproject1/gradle/wrapper/gradle-wrapper.properties ? I have followed the Gradle instructions in gradle.org/install/: downloaded and unzipped gradle-9.2.1-bin, placed it in C:/Program Files/Gradle, and added C:\Program Files\Gradle\gradle-9.2.1\bin to the Path environment variable. However the attempt to create a Gradle project in Netbeans still fails in the same way.

MarkHorn-web avatar Dec 02 '25 01:12 MarkHorn-web

Dear Michael

Thanks for your reply. I have added a comment but it seems that in doing so I pressed a “close” button. Here is the comment, in case you have time to have a look…

In reply to your question about the wizard, sorry but which wizard are you referring to? Also, could you tell me please where is gradleproject1/gradle/wrapper/gradle-wrapper.properties ? I have followed the Gradle instructions in gradle.org/install/: downloaded and unzipped gradle-9.2.1-bin, placed it in C:/Program Files/Gradle, and added C:\Program Files\Gradle\gradle-9.2.1\bin to the Path environment variable. However the attempt to create a Gradle project in Netbeans still fails in the same way.

Regards Mark

From: Michael Bien @.> Sent: Monday, 1 December 2025 8:21 PM To: apache/netbeans @.> Cc: MarkHorn-web @.>; Author @.> Subject: Re: [apache/netbeans] Gradle not found (Issue #9053)

https://avatars.githubusercontent.com/u/114367?s=20&v=4 mbien left a comment (apache/netbeans#9053) https://github.com/apache/netbeans/issues/9053#issuecomment-3595453896

a. Apparently NetBeans is trying to get Gradle from the specified zip file. Why should that be necessary? Isn't Gradle built in to NetBeans already (e.g. like Ant and Maven)?

NB doesn't include the gradle distribution, only the gradle tooling API to interface with gradle.

Did you run the wizard while being disconnected from the internet?

b. The Gradle version (9.2.1) sought here seems to be out of date. The most recent distribution listed at services.gradle.org/distributions is 9.4.0.

9.2.1 is the latest release still, the other files you see on that page are release candidates or milestone builds.

if you want to use a different version, simply change the property in gradleproject1/gradle/wrapper/gradle-wrapper.properties.

— Reply to this email directly, view it on GitHub https://github.com/apache/netbeans/issues/9053#issuecomment-3595453896 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AQH3TX6DSIYQQ4U5J4BJP4337QCBRAVCNFSM6AAAAACNUK4LOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKOJVGQ2TGOBZGY . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AQH3TX7NQXKRYCNT7VFVWV337QCBRA5CNFSM6AAAAACNUK4LOSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTWWJZC4Q.gif Message ID: @.*** @.***> >

MarkHorn-web avatar Dec 02 '25 01:12 MarkHorn-web

a utility called gradle wrapper is used to download the gradle distribution when the project is built (on-demand so to speak). This is an IDE independent feature and happens even if you build the project outside of NetBeans. All you have to do is to be connected to the internet and then create a new gradle project.

In reply to your question about the wizard, sorry but which wizard are you referring to?

this was me referring to the steps you listed to create a new project. UI which sets things up is sometimes called a wizard.

mbien avatar Dec 02 '25 05:12 mbien

OK Michael I understand that, However when I go to create a new (first) Gradle project, I am still getting the same message as before. This is despite my being connected to the internet and without any problem getting access to 'https://services.gradle.org/distributions/gradle-9.2.1-bin.zip' Perhaps a work-around would be to install Gradle myself rather than relying on the wizard. I suppose the wizard is invoked when an existing installation is not found at a given location on the user's machine. Where would that be? As mentioned earlier, I have already downloaded the binary to C:\Program Files\Gradle\gradle-9.2.1 ... So put it somewhere else, and if so, where? Or is there a place in Netbeans where I can specify this Gradle location?

MarkHorn-web avatar Dec 03 '25 03:12 MarkHorn-web

I am still getting the same message as before. This is despite my being connected to the internet and without any problem

interesting. Can you post the log file after a project creation attempt? (please restart NB before first)

default location would be "C:\Users\<user>\AppData\Roaming\NetBeans\28\var\log\messages.log" on your system.

Are you behind a proxy (e.g company network) or something like that?

So put it somewhere else, and if so, where?

gradle would put gradle distributions into its cache folder and NB would uses those. But lets hope the log has more hints for what is going on here.

mbien avatar Dec 03 '25 06:12 mbien

messages.log OK Michael here it is. My username is Mark! -- condensed by Windows from "Mark Horn". No I am not behind a proxy. This is a private project of mine. Thank you for looking at these things, I hope the logfile makes some sense to you.

MarkHorn-web avatar Dec 05 '25 03:12 MarkHorn-web

OK Michael here it is. My username is Mark!

Hi Mark! :)

your user name is indeed Mark! ! (C:\Users\Mark!) which is fascinating since it ends with an !. I didn't even know that windows allowed special characters in user names.

Since I didn't want to impersonate you I created a user called Mike! and could reproduce the issue.

the full exception is:

org.gradle.tooling.GradleConnectionException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-9.2.1-bin.zip'.
	at org.gradle.tooling.internal.consumer.ConnectionExceptionTransformer.transform(ConnectionExceptionTransformer.java:73)
	at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:42)
	at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:68)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)
	at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
	at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:82)
	at org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitStep.execute(TemplateOperation.java:385)
	at org.netbeans.modules.gradle.spi.newproject.TemplateOperation.run(TemplateOperation.java:127)
	at org.netbeans.modules.gradle.spi.newproject.BaseGradleWizardIterator.instantiate(BaseGradleWizardIterator.java:76)
	at org.netbeans.modules.ide.ergonomics.newproject.FeatureOnDemandWizardIterator.instantiate(FeatureOnDemandWizardIterator.java:172)
	at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1046)
	at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:602)
	at org.netbeans.modules.project.ui.NewProjectWizard.handleInstantiate(NewProjectWizard.java:51)
	at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:436)
	at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:228)
	at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:155)
	at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1587)
	at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1531)
	at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:67)
	at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2218)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)
Caused by: org.gradle.internal.impldep.com.google.common.util.concurrent.UncheckedExecutionException: org.gradle.tooling.GradleConnectionException: Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-9.2.1-bin.zip'.
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2074)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache.get(LocalCache.java:3986)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4855)
	at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader.java:50)
	at org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementationLoader.java:44)
	at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.onStartAction(LazyConsumerActionExecutor.java:160)
	at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:142)
	at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
	at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:61)
	at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
	at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:66)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: org.gradle.tooling.GradleConnectionException: Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-9.2.1-bin.zip'.
	at org.gradle.tooling.internal.consumer.loader.DefaultToolingImplementationLoader.create(DefaultToolingImplementationLoader.java:101)
	at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader$ConsumerConnectionCreator.call(CachingToolingImplementationLoader.java:83)
	at org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader$ConsumerConnectionCreator.call(CachingToolingImplementationLoader.java:65)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4860)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3551)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2302)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2177)
	at org.gradle.internal.impldep.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2068)
	... 15 more
Caused by: org.gradle.internal.service.ServiceLookupException: Could not determine implementation class for service 'org.gradle.tooling.internal.protocol.ConnectionVersion4' specified in resource 'jar:file:/C:/Users/Mike!/.gradle/wrapper/dists/gradle-9.2.1-bin/2t0n5ozlw9xmuyvbp7dnzaxug/gradle-9.2.1/lib/gradle-tooling-api-provider-9.2.1.jar!/META-INF/services/org.gradle.tooling.internal.protocol.ConnectionVersion4'.
	at org.gradle.internal.service.DefaultServiceLocator.findServiceImplementations(DefaultServiceLocator.java:131)
	at org.gradle.internal.service.DefaultServiceLocator.implementationsOf(DefaultServiceLocator.java:96)
	at org.gradle.internal.service.DefaultServiceLocator.findFactoriesForServiceType(DefaultServiceLocator.java:105)
	at org.gradle.internal.service.DefaultServiceLocator.findFactory(DefaultServiceLocator.java:84)
	at org.gradle.tooling.internal.consumer.loader.DefaultToolingImplementationLoader.create(DefaultToolingImplementationLoader.java:77)
	... 22 more
Caused by: java.nio.file.NoSuchFileException: C:\Users\Mike
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:52)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:195)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1702)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1493)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:704)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:204)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:150)
	at java.base/java.util.jar.JarFile.<init>(JarFile.java:333)
	at java.base/sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:70)
	at java.base/sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:56)
	at java.base/sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:202)
	at java.base/sun.net.www.protocol.jar.JarFileFactory.getOrCreate(JarFileFactory.java:95)
	at java.base/sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:123)
	at java.base/sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:167)
	at org.gradle.internal.service.DefaultServiceLocator.extractImplementationClassNames(DefaultServiceLocator.java:159)
	at org.gradle.internal.service.DefaultServiceLocator.findServiceImplementations(DefaultServiceLocator.java:126)
	... 26 more

this is actually coming directly from gradle which is not able to deal with the path:

Caused by: org.gradle.internal.service.ServiceLookupException: Could not determine implementation class for service 'org.gradle.tooling.internal.protocol.ConnectionVersion4' specified in resource 'jar:file:/C:/Users/Mike!/.gradle/wrapper/dists/gradle-9.2.1-bin/2t0n5ozlw9xmuyvbp7dnzaxug/gradle-9.2.1/lib/gradle-tooling-api-provider-9.2.1.jar!/META-INF/services/org.gradle.tooling.internal.protocol.ConnectionVersion4'.

This explains why the exception is not in the log file, since it is not NetBeans what is failing.

@lkishalmi However, I tried setting the gradle distribution to a path without an !, unfortunately NB kept using the default path during project initialization:

Image

so there might be no easy workaround available atm outside of creating a user name without special characters.

mbien avatar Dec 05 '25 10:12 mbien

Looks like https://github.com/gradle/gradle/issues/26241 caused by https://bugs.java.com/bugdatabase/view_bug?bug_id=4523159 ? If so, nothing we can do about it here, except possibly check and warn the user?

neilcsmith-net avatar Dec 05 '25 11:12 neilcsmith-net