I believe this problem is not related to module exceptions in JDK 9 (as well as to java.se.ee), but rather because JDK 9 includes a newer version of org.w3c.dom.ls in the java.xml module, which does not have a DocumentLS class.
An important bit of the stack trace is the following:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring-test/test-container.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
Even if I include runtime dependency on this class, for example xerces:xerces 2.4.0 , the JDK module java.xml is preferred (I think).
I am using Gradle 4.1. Is there any way to limit the amount of JDK provided by the module?
source share