-4

I have below jar files: sl4j-log4j12-1.7.25 but while executing i am getting the below error: SLF4J: The requested version 1.6.99 by your slf4j binding is not compatible with [1.5.5, 1.5.6] SLF4J: See here for further details.

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; at org.slf4j.impl.Log4jLoggerAdapter.info(Log4jLoggerAdapter.java:346)

NikNik
  • 2,191
  • 2
  • 15
  • 34

1 Answers1

0

Make sure your slf4j-api version is the same as your slf4j-log version.

Your answer is in the link you provided!

slf4j-api version does not match that of the binding

An SLF4J binding designates an artifact such as slf4j-jdk14.jar or slf4j-> > log4j12.jar used to bind slf4j to an underlying logging framework, say, java.util.logging and respectively log4j. Mixing mixing different versions of slf4j-api.jar and SLF4J binding can cause problems. For example, if you are using slf4j-api-1.8.0-alpha2.jar, then you should also use slf4j-simple-1.8.0-alpha2.jar, using slf4j-simple-1.5.5.jar will not work.

NOTE From the client's perspective all versions of slf4j-api are compatible. Client code compiled with slf4j-api-N.jar will run perfectly fine with slf4j-api-M.jar for any N and M. You only need to ensure that the version of your binding matches that of the slf4j-api.jar. You do not have to worry about the version of slf4j-api.jar used by a given dependency in your project. You can always use any version of slf4j-api.jar, and as long as the version of slf4j-api.jar and its binding match, you should be fine. At initialization time, if SLF4J suspects that there may be a api vs. binding version mismatch problem, it will emit a warning about the suspected mismatch.

MystyxMac
  • 1,532
  • 2
  • 14
  • 28
  • Hi, Thanks.. I have added the same slf4j-api version as slf4j-log version. But while executing got the below error: – Alok Kumar Oct 04 '17 at 14:46
  • Hi, Thanks.. I have added the same slf4j-api version as slf4j-log version. But Igot the below error: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/tcsalku/Downloads/cmdChatbot/cmdChatbot/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] log4j:WARN No appenders could be found for logger (org.alicebot.ab.Bot). – Alok Kumar Oct 04 '17 at 14:48