Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalAccessException when using the new API #101

Closed
kelemen opened this issue Dec 9, 2013 · 4 comments
Closed

IllegalAccessException when using the new API #101

kelemen opened this issue Dec 9, 2013 · 4 comments

Comments

@kelemen
Copy link
Owner

@kelemen kelemen commented Dec 9, 2013

As reported by @shevek in issue #100:

org.gradle.tooling.BuildActionFailureException: The supplied build action failed with an exception.
at org.gradle.tooling.internal.consumer.connection.ActionAwareConsumerConnection.run(ActionAwareConsumerConnection.java:42)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter$1.run(DefaultBuildActionExecuter.java:53)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:82)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
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:724)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:43)
at org.netbeans.gradle.model.GenericModelFetcher.getModels(GenericModelFetcher.java:133)
at org.netbeans.gradle.project.model.NbGradle18ModelLoader.loadModels(NbGradle18ModelLoader.java:177)
at org.netbeans.gradle.project.model.GradleModelLoader.loadModelWithProgress(GradleModelLoader.java:351)
at org.netbeans.gradle.project.model.GradleModelLoader.access$200(GradleModelLoader.java:60)
at org.netbeans.gradle.project.model.GradleModelLoader$3.run(GradleModelLoader.java:176)
at org.netbeans.gradle.project.tasks.GradleDaemonManager.runNonBlockingGradleTask(GradleDaemonManager.java:24)
at org.netbeans.gradle.project.tasks.GradleDaemonManager.access$100(GradleDaemonManager.java:14)
at org.netbeans.gradle.project.tasks.GradleDaemonManager$2.run(GradleDaemonManager.java:105)
at org.netbeans.gradle.project.tasks.GradleDaemonManager$3.run(GradleDaemonManager.java:130)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: Class org.netbeans.gradle.model.util.ReflectionUtils can not access a member of class org.gradle.api.internal.file.AbstractFileCollection$1 with modifiers "public"
at org.netbeans.gradle.model.util.ReflectionUtils.callParameterLessMethodSimple(ReflectionUtils.java:14)
at org.netbeans.gradle.model.util.ReflectionUtils.callParameterLessMethodSimpleFirst(ReflectionUtils.java:36)
at org.netbeans.gradle.model.util.ReflectionUtils.getPropertySimpleFirst(ReflectionUtils.java:69)
at org.netbeans.gradle.model.util.ReflectionUtils.getNonBoolProperty(ReflectionUtils.java:78)
at org.netbeans.gradle.model.java.JavaSourcesModelBuilder.parseClassPaths(JavaSourcesModelBuilder.java:139)
at org.netbeans.gradle.model.java.JavaSourcesModelBuilder.parseSourceSet(JavaSourcesModelBuilder.java:125)
at org.netbeans.gradle.model.java.JavaSourcesModelBuilder.getProjectInfo(JavaSourcesModelBuilder.java:63)
at org.netbeans.gradle.model.java.JavaSourcesModelBuilder.getProjectInfo(JavaSourcesModelBuilder.java:21)
at org.netbeans.gradle.model.internal.DynamicModelLoader.buildAll(DynamicModelLoader.java:31)
at org.gradle.tooling.internal.provider.DefaultBuildController.getModel(DefaultBuildController.java:58)
at org.gradle.tooling.internal.consumer.connection.BuildControllerAdapter.getModel(BuildControllerAdapter.java:74)
at org.gradle.tooling.internal.consumer.connection.BuildControllerAdapter.findModel(BuildControllerAdapter.java:61)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction$2.findModel(GenericModelFetcher.java:429)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction.getModel(GenericModelFetcher.java:289)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction.getModelOutput(GenericModelFetcher.java:278)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction.getFetchedProjectModels(GenericModelFetcher.java:301)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction.execute(GenericModelFetcher.java:427)
at org.netbeans.gradle.model.GenericModelFetcher$ModelFetcherBuildAction.execute(GenericModelFetcher.java:264)
at org.gradle.tooling.internal.consumer.connection.ActionAwareConsumerConnection$BuildActionAdapter.execute(ActionAwareConsumerConnection.java:57)
at org.gradle.tooling.internal.provider.ClientProvidedBuildAction$1.onConfigure(ClientProvidedBuildAction.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy15.onConfigure(Unknown Source)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:92)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.configure(InProcessBuildActionExecuter.java:68)
at org.gradle.tooling.internal.provider.ClientProvidedBuildAction.run(ClientProvidedBuildAction.java:66)
at org.gradle.tooling.internal.provider.ClientProvidedBuildAction.run(ClientProvidedBuildAction.java:33)
at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:108)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:36)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
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:724)
Caused by: java.lang.IllegalAccessException: Class org.netbeans.gradle.model.util.ReflectionUtils can not access a member of class org.gradle.api.internal.file.AbstractFileCollection$1 with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:105)
at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261)
at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.netbeans.gradle.model.util.ReflectionUtils.callParameterLessMethodSimple(ReflectionUtils.java:12)
... 80 more
@kelemen
Copy link
Owner Author

@kelemen kelemen commented Dec 9, 2013

There can be many causes of this issue but having something like this in the build script can reproduce the issue:

sourceSets.main.runtimeClasspath -= configurations.provided

This particular case can be worked around by adding the following code after the previous one:

sourceSets.main.runtimeClasspath += files()

Anyway, it is fixed in master and the fix will be included in 1.2.9.

@shevek
Copy link

@shevek shevek commented Dec 9, 2013

project.sourceSets {
    main.compileClasspath += project.configurations.provided
    main.runtimeClasspath -= project.configurations.provided
    test.compileClasspath += project.configurations.provided
    test.runtimeClasspath += project.configurations.provided
}

For the record, the project uses the stock netflix-gradle-template; that may be worth using as a test case.

@kelemen
Copy link
Owner Author

@kelemen kelemen commented Dec 9, 2013

I have added a simplier test case which tests this issue (ensuring no regression). By the way, you can try to build the plugin from the sources. The only thing about the current state is that it reports exception stack traces in an awkwardly small text area. On the other hand the new API, can now distinguish between issues (build script issue, dependency resolution failures and bugs in the plugin itself).

@shevek
Copy link

@shevek shevek commented Dec 11, 2013

I meant, whatever the status of this bug, the netflix gradle template should be a test case, as it is commonly used, and may throw up other bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants