Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 9: jigsaw and hibernate 5.2.12 doesn't work

In my pom.xml file I have only one dependency:

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.2.12.Final</version>
    </dependency>
</dependencies>

and also a module-info.java

module testmodule {
    requires hibernate.jpa;
    requires hibernate.core;
}

but when I'm trying to run my app I get the error: Caused by: java.lang.IllegalArgumentException: jboss.transaction.api.1.2.spec: Invalid module name: '1' is not a Java identifier. Any thoughts how to deal with it?

like image 204
Tymur Berezhnoi Avatar asked Dec 14 '17 20:12

Tymur Berezhnoi


1 Answers

From the stacktrace, the exception is not for the hibernate-core module but for the jboss-transaction-api_1.2_spec dependency included in your project.

Until the version 1.0.1.Final of the dependency, the automatic module name could not be derived from the jar file name.

enter image description here

This has been though updated in their 2.0.0.Alpha1 release from October 2017 which now has a module-info.class packaged in the jar to get the module name from.

So, you can preferably use 2.0.0.Alpha1 version with module name java.transaction as:

<dependency>
    <groupId>org.jboss.spec.javax.transaction</groupId>
    <artifactId>jboss-transaction-api_1.2_spec</artifactId>
    <version>2.0.0.Alpha1</version>
</dependency>

enter image description here

like image 94
Naman Avatar answered Nov 09 '22 07:11

Naman