Tuesday, March 3, 2009

Problem: Could not initialize class HibernateUtil / org.slf4j.LoggerFactory not found

Hi all,

after testing the "upgrade" to the long awaited version 5.2.2 (I can describe the procedure as well if you are interested) I got some nasty problems with hibernate.

For the portlet "EasyComments" hibernate3 worked fine so far - but suddenly I got the following errors:

Could not initialize class HibernateUtil
at HibernateUtil.closeSession(session);
Annoyingly there was not more to take from the standard out of tomcat (nor from the logs). Only an additional catch blog in the HibernateUtil class showed the real problem:

org.slf4j.LoggerFactory not found

and later:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

So it seems that hibernate is using slf4j internally.
Adding the following jars solved the problem:


The files can be found here:

And finally all worked again.