I\'ve been trying to run Hibernate 5.2.11 application in Java 9/Spring Boot 1.5.x/Maven project but I\'m failing at missing class:
Caused by: java.lang.NoCla
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
.
This is what I think: --add-modules java.se.ee
according to Modules Shared with Java EE Not Resolved by Default will resolve all Java EE modules, used for resolving internal APIs. Therefore, developers don't need to add specific module one by one. On the other side, JDK9 is also separating EE from SE. javax.transaction.SystemException
is no longer in JDK9 library, but it is in EE library. As in java.se.ee
module-info:
@SuppressWarnings({"deprecation", "removal"})
@Deprecated(since="9", forRemoval=true)
module java.se.ee {
requires transitive java.se;
// Upgradeable modules for Java EE technologies
requires transitive java.activation;
requires transitive java.corba;
requires transitive java.transaction;
requires transitive java.xml.bind;
requires transitive java.xml.ws;
requires transitive java.xml.ws.annotation;
}
But for module java.transaction
it has only:
InvalidTransactionException, TransactionRequiredException, TransactionRolledbackException