NoSuchMethodError org slf4j helpers MessageFormatter format

NoSuchMethodError org slf4j helpers MessageFormatter format

Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;

SLF4J: The requested version 1.6.99 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object😉Lorg/slf4j/helpers/FormattingTuple;
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.javahonk.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
    at com.javahonk.util.HibernateUtil.<clinit>(HibernateUtil.java:7)
    at com.javahonk.OneToOneInsert.main(OneToOneInsert.java:16)
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object😉Lorg/slf4j/helpers/FormattingTuple;
    at org.slf4j.impl.Log4jLoggerAdapter.info(Log4jLoggerAdapter.java:322)
    at org.hibernate.cfg.annotations.Version.<clinit>(Version.java:43)
    at org.hibernate.cfg.AnnotationConfiguration.<clinit>(AnnotationConfiguration.java:135)
    at com.javahonk.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:15)
    ... 2 more

Solution: If you are getting above exception it means whatever jar or dependency you are using is not backward compatible with old version. In my case I was using latest version of slf4j-log4j12 as below in maven dependency
which was not compatible with old version:

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

So I changed it to old version to as below:

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

One thought on “NoSuchMethodError org slf4j helpers MessageFormatter format

Leave a Reply

Your email address will not be published. Required fields are marked *