Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: java.lang.NoClassDefFoundError: org/apache/log4j/Level
PostPosted: Mon Sep 15, 2008 9:03 pm 
Newbie

Joined: Mon Sep 15, 2008 8:49 pm
Posts: 2
I ran the tutorials, and I'm getting this weird error. Can't find it anywhere:

run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
[java] at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
[java] at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
[java] at util.EventUtil.initSessionFactory(Unknown Source)
[java] at util.EventUtil.getSessionFactory(Unknown Source)
[java] at util.EventUtil.getSession(Unknown Source)
[java] at util.EventUtil.main(Unknown Source)

Hibernate version:
3.3.1GA

Mapping documents:

Code between sessionFactory.openSession() and session.close():
Transaction transaction = session.beginTransaction();
session.save(event);
transaction.commit();

Full stack trace of any exception that occurs:

run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
[java] at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.java:60)
[java] at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:151)
[java] at util.EventUtil.initSessionFactory(Unknown Source)
[java] at util.EventUtil.getSessionFactory(Unknown Source)
[java] at util.EventUtil.getSession(Unknown Source)
[java] at util.EventUtil.main(Unknown Source)
[java] Java Result: 1

Name and version of the database you are using:

MySQL

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: Fixed
PostPosted: Mon Sep 15, 2008 9:59 pm 
Newbie

Joined: Mon Sep 15, 2008 8:49 pm
Posts: 2
I added external JAR files which fixed the problem. Would have been nice had they been included...


Top
 Profile  
 
 Post subject: Re: Fixed
PostPosted: Tue Oct 14, 2008 9:13 am 
Beginner
Beginner

Joined: Thu Sep 18, 2008 5:18 am
Posts: 28
tommyzed wrote:
I added external JAR files which fixed the problem. Would have been nice had they been included...

Hi, which jar file did you include?


Top
 Profile  
 
 Post subject: Needed JARs
PostPosted: Thu Oct 23, 2008 8:30 am 
Newbie

Joined: Thu Oct 23, 2008 8:11 am
Posts: 1
Hi,

In order for the tutorial to work you will need :

Every jar found in lib/required directory :
    antlr-2.7.6.jar
    commons-collections-3.1.jar
    dom4j-1.6.1.jar
    javassist-3.4.GA.jar
    jta-1.1.jar
    slf4j-api-1.5.2.jar

Plus :
    log4j-1.2.15.jar
    hsqldb.jar
    dom4j-1.6.1.jar
    slf4j-log4j12-1.5.5.jar
    jcl-over-slf4j-1.5.5.jar
    simple-log-2.0.1.jar


You shouldn't have difficulty finding those. Maybe I went a little overboard, but at least now it works :D Some JARs might be useless, you should try removing them one by one to be sure, but this package should be enough for the tutorial to work.

Hope this helped,

Fran├žois


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 16, 2009 9:30 am 
Newbie

Joined: Mon Mar 16, 2009 9:19 am
Posts: 1
Hi,

I resolved the problem about 'run:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level '

I added log4j-1.2.15.jar ..Also the other *.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
slf4j-simple-1.5.6.jar
and necessary others *.jar files..
Thanks,


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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.