Results 1 to 5 of 5
  1. #1
    fierof2 is offline Member
    Join Date
    Jul 2010
    Posts
    24
    Rep Power
    0

    Exclamation Exception in Hello World Program in Hibernate

    Hi All

    I am trying to run my first "Hello World" hibernate program in the book "Java Persitance with Hibernate". I have written the model class and the main class.
    I have also create the mapping file Message.hbm.xml and hibernate configuration file hibernate.cfg.xml through hibernate tools. Now when I am running the main class i am getting the following exception.

    Java Code:
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Exception in thread "main" java.lang.ExceptionInInitializerError
    	at com.hibernate.test.HibernateUtil.<clinit>(HibernateUtil.java:17)
    	at com.hibernate.test.HelloWorld.main(HelloWorld.java:15)
    Caused by: java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
    	at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)
    	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)
    	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
    	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
    	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
    	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
    	at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:165)
    	at com.hibernate.test.HibernateUtil.<clinit>(HibernateUtil.java:15)
    	... 1 more
    Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
    	at java.net.URLClassLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    	... 9 more
    I have added the following jars from the folder hibernate-distribution-3.5.2-Final\lib\required

    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

    and hibernate3.jar to the classpath.

    It would be great if someone could help me in resolving this problem

    Thanks in advance
    Fierof2

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    SLF4J: See SLF4J Error Codes for further details.

    Have you looked there?

  3. #3
    fierof2 is offline Member
    Join Date
    Jul 2010
    Posts
    24
    Rep Power
    0

    Default

    Hi Tolls

    Thanks for you reply.


    As per the link given it say the following jars needs to be added to classpath

    slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar

    As per the hibernate-distribution-3.5.2-Final i have added all the required jar to the class path. If i have missed out something then should this file be present under the folder \hibernate-distribution-3.5.2-Final\lib\required ????

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    "Placing one (and only one) of..."

  5. #5
    fierof2 is offline Member
    Join Date
    Jul 2010
    Posts
    24
    Rep Power
    0

    Default

    Hi Tolls

    Thanks for the support the issue is resolved after adding the jar files mentioned by you.

Similar Threads

  1. Replies: 3
    Last Post: 07-12-2010, 07:15 AM
  2. Replies: 3
    Last Post: 07-04-2010, 12:32 AM
  3. Not able to debug simple hello world program
    By amit123solanki in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 03:41 PM
  4. hibernate hbm.xml exception
    By sundarjothi in forum Advanced Java
    Replies: 0
    Last Post: 05-31-2008, 07:55 AM
  5. Problem with First Hibernate program
    By sireesha in forum JDBC
    Replies: 11
    Last Post: 05-05-2008, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •