If you are using Hibernate 5.+ and Glassfish 4.X or other earlier version , you will probably see this error. That’s happening because there is a conflict between Glassfish modules and your project dependency, more specifically the lib org.jboss.logging
.
It’s happening because the method org.jboss.logging.Logger.debugf
is only available in the jboss-logging version 3.3.0 or later and there is on the Glassfish 4.x module the jboss-logging older version.
Solution 1 – Move back to Hibernate 4
That’s not a great option, but I have to consider it.
Solution 2 – Move to Glassfish 5
The new version of the Glassfish already came with the later version of org.jboss.logging
!
Solution 3 – Trying to downgrade the org.jboss.logging
on the Hibernate 5
Some blogs and answers in stackoverflow explain this option. I don’t think it will work in all contexts. But don’t forget to do the same with all dependencies that use the org.jboss.logging
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
+ <groupId>org.hibernate</groupId> | |
+ <artifactId>hibernate-core</artifactId> | |
+ <version>5.2.12.Final</version> | |
+ <exclusions> | |
+ <exclusion> | |
+ <artifactId>jboss-logging</artifactId> | |
+ <groupId>org.jboss.logging</groupId> | |
+ </exclusion> | |
+ </exclusions> | |
+</dependency> | |
+<dependency> | |
+ <artifactId>jboss-logging</artifactId> | |
+ <groupId>org.jboss.logging</groupId> | |
+ <version>3.2.0.Final</version> | |
+</dependency> |
Solution 4 – Upgrade the org.jboss.logging
in everywhere!
Upgrade the org.jboss.logging
in every place that it’s used, like other dependencies and even the Glassfish modules. Just make sure that the library in use is the later version, omitting the possible earling version being used. To upgrade, just do it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<!–… –> | |
<exclusions> | |
<exclusion> | |
<artifactId>jboss-logging</artifactId> | |
<groupId>org.jboss.logging</groupId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<artifactId>jboss-logging</artifactId> | |
<groupId>org.jboss.logging</groupId> | |
<version>3.3.1.Final</version> | |
</dependency> |
You don’t have to do it, unless a earlier version is being used (not ommited). But, YOU HAVE to upgrade the Glassfish module in glassfish-root-folder/glassfish/module/jboss-logging.jar
, removing it to use only the one from your project or overwriting it with a later one (recommended!).
