[GRADLE-2185] NPE launching Tooling API from Eclipse on Windows Created: 20/Mar/12  Updated: 04/Jan/13  Resolved: 02/Apr/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: 1.0-rc-1

Type: Bug
Reporter: Daz DeBoer Assignee: Daz DeBoer
Resolution: Fixed Votes: 4

Attachments: PNG File GradleError.png    

 Description   

Here are the steps in eclipse:
1. cleaned gradle cache
2. import -> Gradle Project ->
3. Enter location of samples/java/quickstart folder in "root folder" field
4. press "Build Model"

Here are the details of the Eclipse error log. It looks like the deamon was not able to start.

eclipse.buildId=3.7.0b
java.version=1.6.0_21
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86_64

Error
Tue Mar 20 09:33:48 EDT 2012

java.lang.reflect.InvocationTargetException
at com.springsource.sts.gradle.core.util.GradleRunnable.run(GradleRunnable.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.core.runtime.CoreException: Could not fetch model of type 'HierarchicalEclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip'.
at com.springsource.sts.gradle.core.GradleModelProvider$GroupedModelProvider.ensureModels(GradleModelProvider.java:277)
at com.springsource.sts.gradle.core.GradleProject.getGradleModel(GradleProject.java:576)
at com.springsource.sts.gradle.core.GradleProject.getSkeletalGradleModel(GradleProject.java:597)
at com.springsource.sts.gradle.ui.wizards.GradleImportWizardPageOne$9.doit(GradleImportWizardPageOne.java:471)
at com.springsource.sts.gradle.core.util.GradleRunnable.run(GradleRunnable.java:78)
... 1 more
Caused by: org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'HierarchicalEclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:46)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:73)
at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.gradle.api.GradleException: Could not start Gradle daemon.
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:103)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:82)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.createConnection(DefaultDaemonConnector.java:100)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:70)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:104)
at org.gradle.tooling.internal.provider.DaemonGradleLauncherActionExecuter.execute(DaemonGradleLauncherActionExecuter.java:44)
at org.gradle.tooling.internal.provider.DaemonGradleLauncherActionExecuter.execute(DaemonGradleLauncherActionExecuter.java:31)
at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:53)
at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:30)
at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:105)
at org.gradle.tooling.internal.provider.DefaultConnection.getTheModel(DefaultConnection.java:98)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:80)
at org.gradle.tooling.internal.consumer.LazyConnection$3.run(LazyConnection.java:93)
at org.gradle.tooling.internal.consumer.LazyConnection$3.run(LazyConnection.java:91)
at org.gradle.tooling.internal.consumer.LazyConnection.withConnection(LazyConnection.java:101)
at org.gradle.tooling.internal.consumer.LazyConnection.getModel(LazyConnection.java:91)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$2.run(ProgressLoggingConnection.java:58)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$2.run(ProgressLoggingConnection.java:56)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.run(ProgressLoggingConnection.java:72)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.getModel(ProgressLoggingConnection.java:56)
at org.gradle.tooling.internal.consumer.LoggingInitializerConnection.getModel(LoggingInitializerConnection.java:46)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:53)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:51)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:71)
... 4 more
Caused by: org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer$ProcessInitializationException: Failed to configure the standard stream handles to be 'uninheritable'.
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.initialize(WindowsProcessInitializer.java:49)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:92)
... 27 more
Caused by: java.lang.NullPointerException
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.makeUninheritable(WindowsProcessInitializer.java:54)
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.initialize(WindowsProcessInitializer.java:41)
... 28 more



 Comments   
Comment by Nathan Niesen [ 20/Mar/12 ]

I'm having the same issue. The STS Gradle Plugin seems to be having trouble launching the milestone 9 daemon. It wants to use milestone 7 and has no problems starting that daemon but then I get errors because I'm using things not available in 7. I can work around it by manually starting the daemon with the wrapper.

Message:
Could not fetch model of type 'EclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip'.

Session Data:
eclipse.buildId=2.9.0.201203011000-RELEASE
java.version=1.7.0_03
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product com.springsource.sts.ide -showlocation
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.springsource.sts.ide -showlocation

Stack:
org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'EclipseProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.0-milestone-9-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:46)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:73)
at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.gradle.api.GradleException: Could not start Gradle daemon.
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:103)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:82)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.createConnection(DefaultDaemonConnector.java:100)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:70)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:104)
at org.gradle.tooling.internal.provider.DaemonGradleLauncherActionExecuter.execute(DaemonGradleLauncherActionExecuter.java:44)
at org.gradle.tooling.internal.provider.DaemonGradleLauncherActionExecuter.execute(DaemonGradleLauncherActionExecuter.java:31)
at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:53)
at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:30)
at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:105)
at org.gradle.tooling.internal.provider.DefaultConnection.getTheModel(DefaultConnection.java:98)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:80)
at org.gradle.tooling.internal.consumer.LazyConnection$3.run(LazyConnection.java:93)
at org.gradle.tooling.internal.consumer.LazyConnection$3.run(LazyConnection.java:91)
at org.gradle.tooling.internal.consumer.LazyConnection.withConnection(LazyConnection.java:101)
at org.gradle.tooling.internal.consumer.LazyConnection.getModel(LazyConnection.java:91)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$2.run(ProgressLoggingConnection.java:58)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$2.run(ProgressLoggingConnection.java:56)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.run(ProgressLoggingConnection.java:72)
at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.getModel(ProgressLoggingConnection.java:56)
at org.gradle.tooling.internal.consumer.LoggingInitializerConnection.getModel(LoggingInitializerConnection.java:46)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:53)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:51)
at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:71)
... 4 more
Caused by: org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer$ProcessInitializationException: Failed to configure the standard stream handles to be 'uninheritable'.
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.initialize(WindowsProcessInitializer.java:49)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:92)
... 27 more
Caused by: java.lang.NullPointerException
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.makeUninheritable(WindowsProcessInitializer.java:54)
at org.gradle.internal.nativeplatform.jna.WindowsProcessInitializer.initialize(WindowsProcessInitializer.java:41)
... 28 more

Comment by Nathan Niesen [ 20/Mar/12 ]

Gradle error when daemon fails to start.

FYI: The "Attach Screenshot" gives me a blank page after the description in both IE and FF so I couldn't use it.

Comment by Vikas Varma [ 20/Mar/12 ]

I had the same exception when I try to use the STS 2.9.0, eclipse 3.7 in both windows XP & Vista.
Works without any issues on MacOS.

Comment by Nathan Niesen [ 21/Mar/12 ]

I'm not sure if this is a Gradle problem or a Gradle Plugin problem so I created a corresponding Plugin issue: https://jira.springsource.org/browse/GRADLE-50

Comment by Daz DeBoer [ 24/Mar/12 ]

This was a problem with Gradle-1.0-milestone-9. I'm pretty sure I've fixed this in the latest nightly build.
It would be great to have this verified: you can test by telling Eclipse to use the distribution at http://gradle.org/nightly, or update your project's wrapper to point at the nightly distribution.

Comment by Vikas Varma [ 24/Mar/12 ]

It works fine with the latest nightly distribution (1.0-rc-1-20120325000008+0100).

The changes fixes the issue.

Generated at Wed Jun 30 12:15:01 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.