Java 9, Hibernate and java.sql/javax.transaction

I've tried to "upgrade" a project using Hibernate to Java 9, but I am having problems getting the module to function properly.

The relevant part of my looks like this:

module test {


    requires java.base;
    requires hibernate.core;
    requires java.naming;


and the relevant dependencies in my POM are

  • javax.xml.bind:jaxb-api, 2.3.0
  • org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec, 2.0.0.Alpha1
  • org.hibernate:hibernate-core, 5.2.12.Final
  • javax.transaction:javax.transaction-api, 1.2

The problem is, if I run the program, I get a NoClassDefFoundError for javax/transaction/SystemException. I looked into this, and quite obviously, my module is missing a requires on javax.transaction.

So I add a module dependency on javax.transaction-api. I then go on and attempt to run the program again - now I'm missing java/sql/SQLException.

Here is what I am having a problem with: if I add a dependency on the module java.sql, which contains this class, I end up with a conflict:

module reads package javax.transaction.xa from both java.sql and javax.transaction.api

java.sql and javax.transaction.api contain different packages, and have one in common (javax.transaction.xa), but I require all of them.

How do I deal with this? Is there something simple I am missing?