Hibernate, Java 9 and SystemException

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;

Additionally while using the maven-failsafe-plugin, make sure you are using the minimum compatible version 2.20.1 or above as mentioned in the progress document of Maven.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.20.1</version>
</plugin>

@Deprecated(forRemoval=”after OP’s confirmation”)

On the other hand, a temporary workaround (since eventually these modules will be removed from the JDK) could be to make use of:-

--add-modules java.transaction

As mentioned in the comments, since the required dependency for javax.transaction-api is already available on the classpath, you shouldn’t be required to add any compiler option or else you would end up overriding the current package with the java.transaction module’s exported javax.transaction package which ideally for your use case doesn’t consist of SystemException.

Leave a Comment