1

When I click Run As->Spring Boot App , I encounter the following error message:

Exception in thread "main" java.lang.ExceptionInInitializerError at org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader.(GroovyBeanDefinitionReader.java:129) at org.springframework.boot.BeanDefinitionLoader.(BeanDefinitionLoader.java:84) at org.springframework.boot.SpringApplication.createBeanDefinitionLoader(SpringApplication.java:668) at org.springframework.boot.SpringApplication.load(SpringApplication.java:609) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:961) at org.springframework.boot.SpringApplication.run(SpringApplication.java:950) at com.connectedworldservices.de.app.main.Application.main(Application.java:45) Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.8 and you are trying to load version 2.3.2 at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:509) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:77) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:71) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:53) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:110) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:71) at groovy.lang.GroovySystem.(GroovySystem.java:33) ... 8 more

I have seen that a few people have said that it is something to do with the classpath, but cannot find out how this would be changed in Spring Tools Suite. If I click on the folder in the project and click on Run Configuration, I can see a classpath tab but cannot see a Groovy reference in there although in the source tab I can see references to Groovy 2.3.8 and 2.3.2, but when I click on them, the option to remove them is greyed out.

Does anyone know how I can fix this problem in Spring Tools Suite?

Thanks for any help.

Martin Lippert
  • 5,988
  • 1
  • 15
  • 18
user3165854
  • 1,505
  • 8
  • 48
  • 100

1 Answers1

3

This happens because you're using the Groovy plugin for Eclipse. When it detects a Groovy project, it attaches a Groovy runtime to the project since you probably want one. Spring Boot does the same and you end up with two different versions of Groovy on the classpath.

To solve this, you need to open the "Java Build Path" properties of your project, click on the "Libraries" tab and then remove the entry "Groovy Runtime Libraries".

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • "Groovy Runtime Libraries" is not present in the Libraries menu for me. But, I was able to fix the version issue with this answer - https://stackoverflow.com/a/42650053/6648326 – MasterJoe Jan 18 '19 at 22:24