Hibernate Annotations 3.4 and SLF4J

Hibernate annotations 3.4 has switched to slf4j as its logging framework. if you get this error

NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

Then you need to grab the appropriate slf4j implementation for your logging framework. Hibernate doesn’t ship with these – just a copy of slf4j-api.jar – so you’ll need to download slf4j and grab the necessary jar (slf4j-log4j12-1.5.6.jar, slf4j-jdk14-1.5.6.jar, etc.) from the distribution.

However, you’ll also need to grab slf4j-api.jar from the distribution, because the version in the hibernate annotations distro is (as of this writing) out of date wrt the slf4j distro, and you hae the wrong version you’ll see this error:

IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory

Comments are closed.