3

I'm getting below exception while running basic groovy script from console after installation. For installation I have used the installer:

Java version: jdk-9.0.1 , jre-9.0.1

Exception thrown

java.lang.NoClassDefFoundError: Unable to load class groovy.xml.jaxb.JaxbGroovyMethods due to missing dependency javax/xml/bind/Marshaller

    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)
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
Saianil Kumarreddy
  • 161
  • 1
  • 1
  • 6

1 Answers1

1

Java 9 doesn't package the 'javax.xml' by default. Add --add-modules java.xml.bind to your command line argument when running.

See How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9

Ben Harris
  • 1,734
  • 3
  • 15
  • 24