NoSuchMethodError with SLF4J API

Also make sure if you deploy in Glassfish externally (not locally) to remove duplicate dependencies in the lib folder of the Glassfish installation on that server.

In my case, everything worked fine locally but once deployed on a server I got this error.


Looks like you have a version mis-match between the various SLF4J API and integration libraries. SLF4J is extremely twitchy when it comes to version compatibility (e.g. 1.6.x is not backwards compatible with 1.5.x).

Make sure the various JAR versions match, and make sure there are no duplicate JARs on the classpath.


I was getting this error:

SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
.
.
.

Now I just commented line with version from pom.xml, as shown below, and it is working now:

    <dependency> 
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <!-- <version>1.6.5</version> -->
    </dependency>

Tags:

Java

Slf4J