3

I am trying to make a Java 11 project using Gradle, JavaFX and Hibernate. After adding Hibernate dependency i encountered a problem described in this post

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

Although I fixed the problem described in this post another problem occured:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules stax.api and java.xml export package javax.xml.stream to module javafx.baseEmpty

This problem only appears when I am running poject using Gradle, when I run it directly from Intellij wverything is working fine.

Those are dependencies which I use:

dependencies {
    compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.13'
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.6.Final'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.4'
    compile group: 'com.sun.xml.bind', name: 'jaxb-core', version:   '2.3.0.1'
    compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.1'
    compile 'com.sun.activation:javax.activation:1.2.0'
}

Thanks for any help!

  • I have the same issue with other modules `ResolutionException: Modules java.activation and jakarta.activation export package javax.activation to module spring.boot.starter.web`. I believe that with gradle you can exclude one of the conflicting modules, however I didn't find out yet how exactly. I do already have some exclusion for logging frameworks since there were multiple present. That looks like this in my build.gradle: `configurations.all { exclude group: 'org.slf4j', module: 'slf4j-log4j12' }` – judos Jun 24 '20 at 22:28

0 Answers0