-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Setup Help
PostPosted: Thu Apr 08, 2010 3:05 am 
Newbie

Joined: Thu Apr 08, 2010 2:55 am
Posts: 2
Hi Gang,

I desperately need some help setting up a "Hello World" using Hibernate and Eclipse. I just can't seem to get it to work. I've downloaded the hibernate-distribution-3.5.0-Final and extracted the zip file. I've created a Eclipse project and added the following .jar files to my project:
    hibernate3.jar
    antlr-2.7.6.jar
    commons-collections-3.1.jar
    dom4j-1.6.1.jar
    javassist-3.9.0.GA.jar
    jta-1.1.jar
    slf4j-api-1.5.8.jar
    mysql-connector-java-5.1.12-bin.jar
But when I compile the code below I get an error
Code:
package hiberaction;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class Main
{

   /**
    * @param args
    */
   public static void main(String[] args)
   {
      Configuration cfg = new Configuration();
      cfg.addClass(hiberaction.pojos.Message.class);
      cfg.setProperties(System.getProperties());
      SessionFactory sessions = cfg.buildSessionFactory();

   }

}

Code:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I've tried adding other jars but I just can't get it to work. Doesn't the hibernate download come with all the jars that I need (besides the SQL connection)? I've added all the jars in the "required" folder of hibernate so why doesn't it work? ARGH!!!!!

Any tips?
Cheers
-whizzle-


Top
 Profile  
 
 Post subject: Re: Hibernate Setup Help
PostPosted: Thu Apr 08, 2010 3:59 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hiberante uses SLF4J for logging but SLF4J is just a facade and needs a concrete logging implementation.
You can choose between several logging implementations (see the page of SLF4J) the most used with hiberante
is probably log4j so in this case you must add the jars slf4j-log4j12-1.5.8.jar and log4j.jar (must be a 1.2 version)
to your classpath.


Top
 Profile  
 
 Post subject: Re: Hibernate Setup Help
PostPosted: Sat Apr 10, 2010 4:55 am 
Newbie

Joined: Thu Apr 08, 2010 2:55 am
Posts: 2
okay, thanks a bunch. So the answer is, "No." Hibernate does NOT come with everything needed get it to work out of the box. I've added the additional jar and now everything works.

Thanks a bunch!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.