Grails / Groovy / GGTS: Conflicting module versions on run-app
Asked Answered
A

16

20

After upgrading a Grails application from 2.2.0 to 2.2.1 I keep getting the following error when attempting to debug a Grails application from GGTS via Debug as... -> Grails Command (run-app):

Error starting Grails: nulljava.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:221)
at groovy.lang.Closure.<init>(Closure.java:238)
at groovy.lang.Closure$1.<init>(Closure.java:205)
at groovy.lang.Closure.<clinit>(Closure.java:205)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.<clinit>(GrailsScriptRunner.java:84)
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:601)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.0.5 and you are trying to load version 2.0.7
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromProperties(MetaClassRegistryImpl.java:186)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromMetaInf(MetaClassRegistryImpl.java:174)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerClasspathModules(MetaClassRegistryImpl.java:156)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:111)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
... 14 more

I'm running GGTS 3.1.0.RELEASE with the Groovy Compiler 2.0 Feature 2.7.1.xx-20120921-2000-e42RELEASE and Groovy/Grails Tool Suite 3.1.0.201210061306-RELEASE-e42. The project has configured Groovy Compiler level 2.0. Eclipse Preferences say "You are currently using Groovy Compiler version 2.0.4.xx-20120921-2000-e42RELEASE".

Any hints?

Aldredge answered 26/2, 2013 at 0:37 Comment(3)
I think a grails clean might be in order. Refresh dependencies after cleaning and try running the app again.Tiphane
Tried that, didn't help unfortunately.Aldredge
Related: #29116591Slide
A
0

I have no explanation why it didn't work, but I found a workaround.

I had another run target configured for the same app, but with a -Dgrails.env=... setting, which I could launch without problems. I simply copied this config and removed the parameter. That way, I basically recreated the simple launch config which previously kept failing.

Problem gone.

Aldredge answered 27/2, 2013 at 0:16 Comment(1)
For what it's worth, I hit this error with a project I recently updated from 2.2.0 to 2.2.1. Using GGTS 3.2.0 RELEASE with Groovy Compiler 2.0.7.xx-20130304-1200-e42, groovy compiler level 2.0 set for project. The clean/refresh deps appears to have fixed this issue for me. Not sure why I started seeing it today, I upgraded the project a few days ago but have successfully run it in run-app as well as war-deployed so... shrugInsistent
F
30

i had this problem on Grails 2.2.0 on Ubuntu machine , i fixed it with the below steps :

  1. open eclipse go to "Run as" the "Run Configurations"
  2. choose "Environment" tab , then choose "replace native environment with specified environment "

that solved the problem for me .. hope this help

Fellner answered 25/12, 2013 at 14:15 Comment(1)
Thanks for this tip - it worked in my case. I think its because I have my groovy project pointed to a newer grails install elsewhere that is using a different groovy version than the one in my STS install.Ha
G
28

I had the same problem, I was picking up groovy-all 2.0.7 from GGTS and 2.0.8 from my grails project. To resolve the problem I removed the "Groovy Dependencies" library from the eclipse project.

Right click on project -> Properties -> Java Build Path -> Libraries (tab) -> Groovy Dependencies -> Remove

Galvanic answered 16/9, 2013 at 7:33 Comment(3)
For me and GGTS 3.4.0 it was: removing "project -> Properties -> Java Build Path -> Libraries (tab) -> Groovy Libraries". Then clean project, grails clean, grails refresh-dependencies, and all was good.Megasporangium
I think this is the first thing to try if you're using maven/gradle managed dependencies; it worked perfectly for me, it's a general fix for any groovy project (even if it's not a grails one)Marcello
It worked perfectly for me... Had to live with that error for a while by manually updating pom file. How fool was I!Jook
S
10

Manually delete the run-app Run Configuration so it gets recreated. This was reported as a bug on Aug. 1st, 2013. Bug report: https://issuetracker.springsource.com/browse/STS-3501

Screwball answered 12/1, 2014 at 1:45 Comment(1)
At first it looked like this worked for me (GGTS 3.4.0 w/ Grails 2.2.4). But it came back in a subsequent test-app execution.Megasporangium
R
5

I deleted .metadata in GGTS workspace and reimport project. It works, I can run-app again.

Reassure answered 13/6, 2013 at 1:52 Comment(0)
B
3

I had the same exception, when I was trying to run JUnit tests on my Spring boot project in Eclipse only, mvn executes them fine. I'm not using Gradle or Groovy. Indeed checking the test's class path upon debug, showed two versions of groovy.jar. The work version of the groovy.jar was picked from other projects in the Eclipse workspace. I was able to fix it by removing Resolve dependencies from Workspace projects in project properties -> Maven Resolve dependencies from Workspace projects

Bloemfontein answered 7/3, 2017 at 13:49 Comment(0)
M
2

I had the same problem and i solved it by:

  1. For your project: Open Run As->Run Configurations
  2. Go to the Refresh tab
  3. Check the Refresh resources upon completion
  4. Press Run

That did the trick for me.

Marjoriemarjory answered 31/1, 2014 at 15:19 Comment(0)
O
1

I solved it by removing the option to manually load the classpath in Run Configuration. It was using the wrong Grails version (2.5.0 instead of 2.5.1).

Basically the wrong classpath was used.

Maybe this brings someone on the correct path :)

Oyler answered 15/10, 2015 at 8:27 Comment(0)
A
0

I have no explanation why it didn't work, but I found a workaround.

I had another run target configured for the same app, but with a -Dgrails.env=... setting, which I could launch without problems. I simply copied this config and removed the parameter. That way, I basically recreated the simple launch config which previously kept failing.

Problem gone.

Aldredge answered 27/2, 2013 at 0:16 Comment(1)
For what it's worth, I hit this error with a project I recently updated from 2.2.0 to 2.2.1. Using GGTS 3.2.0 RELEASE with Groovy Compiler 2.0.7.xx-20130304-1200-e42, groovy compiler level 2.0 set for project. The clean/refresh deps appears to have fixed this issue for me. Not sure why I started seeing it today, I upgraded the project a few days ago but have successfully run it in run-app as well as war-deployed so... shrugInsistent
N
0

For me a compile from the grails command window did the trick

Nostology answered 22/3, 2013 at 8:40 Comment(0)
T
0

I had the same problem when running it through eclipse and what worked for me is to make the below changes Go to Project properties -> Groovy Compiler ->configure workspace settings . Uncheck the checkbox "Enable checking for mismatch between project and workspace groovy compiler levels"

Transsonic answered 22/3, 2013 at 23:55 Comment(0)
S
0

When I change the grails project's name it works correctly.

Stagecoach answered 15/5, 2013 at 22:9 Comment(0)
S
0

Another solution worked for me when Eclipse stopped being able to run my project with the "groovy-all is loaded in version ... and you are trying to load version" error.

Manually removing a groovy-all line from the .classpath fixed it.

<classpathentry kind="lib" path="Libraries/groovy-all-2.1.2.jar"/>

I found the solution in this blog post.

Slide answered 19/9, 2015 at 19:34 Comment(1)
I did the same thing via Eclipse. Right click project & choose Build Path --> Configure. Click Libraries tab. Click Groovy Runtime Libraries, then click Remove. Appears to have the same effect as this answer, without hand-editing the .classpath file.Emotion
G
0

I had the same problem, I went to Project properties -> Groovy Compiler ->configure workspace settings and I clicked on the "Switch to" button that corresponded to one of the two versions in the error message. I hope this will help

Geyserite answered 30/9, 2015 at 12:49 Comment(0)
C
0

I know this is a GGTS question, but Google led me here and this seems to be a common issue even after several years so I'm posting this answer here. Hopefully it can help other STS users who also land here.

I had this problem with Spring Tool Suite, using Spring Boot Version 1.3.3.RELEASE and gradle version 2.14. There is some internal dependency on groovy 2.4.6 and groovy-all 2.4.6, but my Eclipse workspace Groovy Libraries are version 2.4.7. Removing the Groovy Libraries from the Spring/Gradle project properties(s) works for running those projects, but for other Groovy projects in the workspace you are stuck between a rock and a hard place. They will either run if you click yes when "Errors exist in project. Run anyway?" if you remove the Groovy libs from the properties build path, or they will not have project errors if you put the Groovy libs in the properties build path.

Resolved by adding explicit dependencies in build.gradle on groovy 2.4.7 and groovy-all 2.4.7 for Gradle projects in the workspace

compile('org.codehaus.groovy:groovy:2.4.7')
compile('org.codehaus.groovy:groovy-all:2.4.7')

and (close Eclipse STS) then removing the 2.4.6 folder(s) from the .gradle cache

<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.4.6
<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.6

and (Open STS) then right-click gradle project(s)>gradle>refresh gradle project

Now other Groovy projects in the workspace run without the 2.4.6 vs 2.4.7 conflict.

Chanteuse answered 12/1, 2017 at 18:1 Comment(0)
A
0

use mvn denpendency:tree to check your dependencies, maybe there exist version conflicts.

Ansel answered 30/6, 2017 at 9:36 Comment(0)
B
0

Currently (using Eclipse 2020-06, 4.16.0) none of the above solutions work any more.

  1. Open the Run Configuration of your groovy script
  2. Remove all User Entries from the Classpath tab
  3. Press "Restore Default Entries"

This should add the default classpath containing your specified Groovy version as User Entry.

Boraginaceous answered 4/8, 2020 at 12:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.