NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String)

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.


<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>

view raw

pom.xml

hosted with ❤ by GitHub

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:


<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>

view raw

pom.xml

hosted with ❤ by GitHub

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!).

tree-3045830_640
from pixabay.com

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair /  Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair /  Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair /  Alterar )

Conectando a %s