I have a Hibernate 5 project that perfectly builds and runs on Java 8. I tried to test it on JDK 9 ea build 171. Since it is a huge project and have other dependencies I ha
Though the question seems old, yet unanswered and since the GA release of JDK is completed. According to the migration guide and the java docs, since the module java.transaction which exports the package javax.transaction
has been marked as @Deprecated
.
You should ideally migrate your code to be using javaee/javax.transaction instead. Currently, you can do so using automatic module converted from the dependency:
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
</dependency>
and adding to the module-info.java
the following:-
requires javax.transaction.api;
Edit: Thanks to @ImpulseTheFox for verifying that the automatic module name for the jar version 1.3 above requires:-
requires java.transaction;
Java SE defines a small subset of JTA. It doesn't include javax.transaction.SystemException as that exception is in the Java EE version of JTA, not the Java SE subset.
When you run with --add-modules java.se.ee
then it causes the modules shared between Java SE and Java EE to be resolved, this includes the the java.transaction module. Any attempt to load a type in the javax.transaction package will be loaded from the java.transaction module but since this module only has a small subset of JTA then javax.transaction.SystemException will not be found.
If you drop --add-modules java.se.ee
from your command line then you'll find that javax.transaction.SystemException can be loaded, as it's on the class path. So if you only need JAXB (module java.xml.bind) then specify that module to --add-modules
, not the "java.se.ee" aggregator that will cause all modules shared with Java EE to be resolved.