Discussion:
Could not initialize class org.codehause.groovy.runtime.InvokerHelper
Mark Drew
2011-06-03 18:05:12 UTC
Permalink
I have a Groovy project that builds just fine on one machine. However, I
just moved it to another machine, and now the :compileGroovy task fails.
The cause listed is

Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

When I run with --debug --stacktrace --info, the stacktrace is

org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':compileGroovy'.
at org.gradle.api.internal.tasks.execution.
ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:71)
...many more lines...
Caused by java.lang.NoClassDefFoundError: Could not initialize class
org.codehaus.groovy.runtime.InvokerHelper
at org.gradle.api.AntBuilder.<init>(AntBuilder.java:23)
...many more lines...

gradle -v reports Gradle 1.0-milestone-3 and Groovy: 1.7.10.

I also have Groovy 1.8 installed (as I did on the machine for which this
build worked), but I have not explicitly put it into any classpaths. It is
a dependency of the project I'm building, though. I have tried removing
groovy 1.8 from my PATH variable, but that doesn't seem to help. Any other
suggestions/help would be greatly appreciated. Thanks!

Mark
Peter Niederwieser
2011-06-03 22:14:49 UTC
Permalink
Post by Mark Drew
I have a Groovy project that builds just fine on one machine. However, I
just moved it to another machine, and now the :compileGroovy task fails.
The cause listed is
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Have you tried to reinstall Gradle? Maybe the current installation got
tampered with.

--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Blog: http://pniederw.wordpress.com
Twitter: @pniederw



--
View this message in context: http://gradle.1045684.n5.nabble.com/Could-not-initialize-class-org-codehause-groovy-runtime-InvokerHelper-tp4452034p4452722.html
Sent from the gradle-user mailing list archive at Nabble.com.
Mark Drew
2011-06-04 20:50:14 UTC
Permalink
I just installed it, but I can try reinstalling it on Monday.

Thanks!
Mark
Post by Peter Niederwieser
Post by Mark Drew
I have a Groovy project that builds just fine on one machine. However, I
just moved it to another machine, and now the :compileGroovy task fails.
The cause listed is
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Have you tried to reinstall Gradle? Maybe the current installation got
tampered with.
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Blog: http://pniederw.wordpress.com
--
http://gradle.1045684.n5.nabble.com/Could-not-initialize-class-org-codehause-groovy-runtime-InvokerHelper-tp4452034p4452722.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Mark Drew
2011-06-09 19:48:58 UTC
Permalink
When I reinstalled (as Peter suggested), I noticed that the stacktrace was
different the first time than each subsequent time, which reminded me that I
was using the --daemon option. Omitting that option, I now get this
consistently:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':compileGroovy'.
at org.gradle
.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
...many more lines...
Caused by java.lang.NoClassDefFoundError: org/objectweb/asm/Opcodes
at org.gradle.api.AntBuilder.<init>(AntBuilder.java:23)
...many more lines...

Notice that though the stacktrace is almost the same as before, the message
of the NoClassDefFoundError is different. Does this shed any light on this
problem for any of you (unfortunately, it doesn't for me)?

Thanks in advance!
Mark
Post by Mark Drew
I just installed it, but I can try reinstalling it on Monday.
Thanks!
Mark
Post by Peter Niederwieser
Post by Mark Drew
I have a Groovy project that builds just fine on one machine. However,
I
Post by Mark Drew
just moved it to another machine, and now the :compileGroovy task fails.
The cause listed is
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Have you tried to reinstall Gradle? Maybe the current installation got
tampered with.
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Blog: http://pniederw.wordpress.com
--
http://gradle.1045684.n5.nabble.com/Could-not-initialize-class-org-codehause-groovy-runtime-InvokerHelper-tp4452034p4452722.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Mark Drew
2011-06-10 13:14:23 UTC
Permalink
Ok, I finally figured this out, and it was pretty dumb, but for the benefit
of anyone else, here's what happened.

First, I wrote a task to print the runtime classpath like this

task printCp {
println configurations.runtime.resolve().join('\n')
}

Using this task on both machines (the one on which the build was not working
is isolated/not-connected to any network--I probably should've mentioned
that before--sorry), I noticed the following difference. For the networked
machine, this task output

.../.gradle/cache/com.google.guava/guava/jars/guava-r09.jar
.../.gradle/cache/org.codehaus.groovy/groovy/jars/groovy-1.8.0.jar
.../.gradle/cache/antlr/antlr/jars/antlr-2.7.7.jar
.../.gradle/cache/asm/asm/jars/asm-3.2.jar
.../.gradle/cache/asm/asm-commons/jars/asm-commons-3.2.jar
.../.gradle/cache/asm/asm-tree/jars/asm-tree-3.2.jar
.../.gradle/cache/asm/asm-util/jars/asm-util-3.2.jar
.../.gradle/cache/asm/asm-analysis/jars/asm-analysis-3.2.jar
.../.gradle/cache/commons-cli/commons-cli/jars/commons-cli-1.2.jar

but for the isolated machine the task only output
<mark-3lQQ/***@public.gmane.org>
.../.gradle/cache/com.google.guava/guava/jars/guava-r09.jar
.../.gradle/cache/org.codehaus.groovy/groovy/jars/groovy-1.8.0.jar
.../.gradle/cache/commons-cli/commons-cli/jars/commons-cli-1.2.jar

which of course explains my NoClassDefFoundErrors and points me in the
obvious direction--I'm not getting groovy's dependencies on my classpath.
The problem was that when I 'uploaded' groovy to the maven repo on my
isolated machine, I neglected to upload the correct pom with it (which
declares its dependencies). (My networked machine is just pointed at maven
central.) Once I corrected this everything worked fine.

So while there may not have been much chance of much help from this list (my
own fault), the trick for me (a Gradle newb) was figuring out how to see the
classpath that was being used.

Mark
Post by Mark Drew
When I reinstalled (as Peter suggested), I noticed that the stacktrace was
different the first time than each subsequent time, which reminded me that I
was using the --daemon option. Omitting that option, I now get this
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':compileGroovy'.
at org.gradle
.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
...many more lines...
Caused by java.lang.NoClassDefFoundError: org/objectweb/asm/Opcodes
at org.gradle.api.AntBuilder.<init>(AntBuilder.java:23)
...many more lines...
Notice that though the stacktrace is almost the same as before, the message
of the NoClassDefFoundError is different. Does this shed any light on this
problem for any of you (unfortunately, it doesn't for me)?
Thanks in advance!
Mark
Post by Mark Drew
I just installed it, but I can try reinstalling it on Monday.
Thanks!
Mark
Post by Mark Drew
Post by Mark Drew
I have a Groovy project that builds just fine on one machine. However,
I
Post by Mark Drew
just moved it to another machine, and now the :compileGroovy task
fails.
Post by Mark Drew
The cause listed is
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Have you tried to reinstall Gradle? Maybe the current installation got
tampered with.
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Blog: http://pniederw.wordpress.com
--
http://gradle.1045684.n5.nabble.com/Could-not-initialize-class-org-codehause-groovy-runtime-InvokerHelper-tp4452034p4452722.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Loading...