Groovy version: 2.5.1 Java version: 10.0.2
Trying to launch the groovyConsole I get the following:
$ groovyConsole
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/opt/groovy/libexec/lib/groovy-2.5.1.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
Caused by: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/Unmarshaller
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:407)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:400)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.scanExtClasses(MacroMethodsCache.java:88)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.access$000(MacroMethodsCache.java:45)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$2.onModule(MacroMethodsCache.java:69)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.getMacroMethodsFromClassLoader(MacroMethodsCache.java:76)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:53)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:50)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:123)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.get(MacroMethodsCache.java:50)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.findMacroMethods(MacroCallTransformingVisitor.java:118)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.visitMethodCallExpression(MacroCallTransformingVisitor.java:89)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
plus more.......................................
Also got the same issue when using java 11.0.2 and groovy 2.5.5 in IntelliJ.
Found this post that helps! https://www.logicbig.com/tutorials/misc/groovy/intellij.html
Basically have to add JAXB dependencies
Also you have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies as shown
Three suggestions are in the release notes for 2.5.1:
http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Addendum251
In 2.5.2, probably a week or two away, you won't need to do them - grab the snapshot version from the CI server if you want to try it out now.
I've also got this when I debugged some my groovy scripts with groovy 2.5.4 and java 10.
Setting JAVA_OPTS=--add-modules java.xml.bind
solved the mentioned problem for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With