-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: SLF4J: Failed to load class "org.slf4j.impl.StaticLogge
PostPosted: Tue Sep 16, 2008 8:02 am 
Newbie

Joined: Tue Sep 16, 2008 7:44 am
Posts: 3
Hi,

I am a newbie to Hibernate and I am trying to run the Event example described in the tutorial (http://www.hibernate.org/hib_docs/v3/re ... orial.html).

When I run my project, I get the following error message:

Code:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
Exception in thread "main" java.lang.ExceptionInInitializerError
        at util.HibernateUtil.<clinit>(HibernateUtil.java:17)
        at org.hibernate.tutorial.domain.EventManager.createAndStoreEvent(EventManager.java:23)
        at org.hibernate.tutorial.domain.EventManager.main(EventManager.java:15)
Caused by: java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
        at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
        at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
        at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
        ... 2 more


When I take a look at http://www.slf4j.org/codes.html#StaticLoggerBinder, it says:

Quote:
This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.


I have checked my libraries and I have slf4j-api-1.5.2.jar included my project. I have checked the content of the hibernate-distribution-3.3.1.GA I have downloaded and unzipped, but I cannot find any of the .jars mentioned above.

Does anyone know the solution to this problem?

Thanks,

J.

Hibernate version:

3.3.1

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="events.Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="native"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

session.beginTransaction();

Event theEvent = new Event();
theEvent.setTitle(title);
theEvent.setDate(theDate);

session.save(theEvent);

session.getTransaction().commit();


Full stack trace of any exception that occurs:

See above

Name and version of the database you are using:

hsqldb, version 1.8.0.10

The generated SQL (show_sql=true):

N.A.

Debug level Hibernate log excerpt:

N.A.

_________________
J.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2008 9:05 am 
Newbie

Joined: Tue Sep 16, 2008 7:44 am
Posts: 3
I have downloaded the missing .jar files and added them to my project. It now works, but I had another issue. The solution can be found here: http://groups.google.com/group/comp.lan ... 699b02fb5e

Cheers,

J.

_________________
J.


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Sun Oct 19, 2008 6:39 am 
Newbie

Joined: Sun Oct 19, 2008 6:02 am
Posts: 1
Thank you!

UseTheFork wrote:
I have downloaded the missing .jar files and added them to my project. It now works, but I had another issue. The solution can be found here: http://groups.google.com/group/comp.lan ... 699b02fb5e

Cheers,

J.

_________________
------------------------------------
http://www.digitalassassin.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2008 5:52 am 
Newbie

Joined: Tue Nov 11, 2008 5:36 am
Posts: 5
Location: Stockholm, Sweden
I ran into this problem when running Hibernate annotations 3.4.0 GA against Hibernate core 3.3.0.SP1 through maven.

When I upgraded core to 3.3.1.GA I never saw this problem again.

The following maven pom dependencies works for me:
Code:
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>3.3.1.GA</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-annotations</artifactId>
    <version>3.4.0.GA</version>
</dependency>
<dependency><!-- java bytecode processor -->
    <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.4.GA</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.2</version>
</dependency>


Note: I use Log4j 1.2.14


Top
 Profile  
 
 Post subject: Re: SLF4J: Failed to load class "org.slf4j.impl.StaticLogge
PostPosted: Tue Sep 01, 2009 1:44 pm 
Newbie

Joined: Wed Aug 12, 2009 10:45 am
Posts: 16
Had the same problem, did not want to mix manual and automatic dependency management. Luckily I found a good way to get around this and any other such problems.

As a rule of thumb, whenever you run into such problems, just add another dependency using maven.
I added:
slf4j-jdk14-1.5.8.jar

it gave me another problem, researched it and they said it needs javaassist, so I added this one too:

javassist-3.7.ga.jar

Now everything works perfect.


Top
 Profile  
 
 Post subject: Re: SLF4J: Failed to load class "org.slf4j.impl.StaticLogge
PostPosted: Wed Sep 02, 2009 6:28 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Make sure that the jar file slf4j-jdk14-1.5.8.jar is on your runtime classpath.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: SLF4J: Failed to load class "org.slf4j.impl.StaticLogge
PostPosted: Fri Sep 18, 2009 4:26 am 
Newbie

Joined: Mon Oct 06, 2008 2:50 am
Posts: 3
Are the Hibernate dependencies in adequately specified? Perhaps the slf4j-api dependency can be implemented by your own favorite implementation and therefore it isn't specified. This kind of defeats the purpose of using maven though in my book. BTW is there a way to get all the maven jars without having to specify them as separate dependencies?


Top
 Profile  
 
 Post subject: Re: SLF4J: Failed to load class "org.slf4j.impl.StaticLogge
PostPosted: Mon Aug 16, 2010 3:17 pm 
Newbie

Joined: Mon Aug 16, 2010 3:15 pm
Posts: 1
THIS WORKS....

http://www.slf4j.org/manual.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.