Urgent need help in Hibernate Configuration file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashi1290
    New Member
    • Feb 2008
    • 6

    #1

    Urgent need help in Hibernate Configuration file

    I am getting this error.....
    Exception in thread "main" java.lang.NoCla ssDefFoundError : org/apache/commons/logging/LogFactory
    at org.hibernate.c fg.Configuratio n.<clinit>(Conf iguration.java: 120)
    at com.author.hbn. HibernateUtil.< clinit>(Hiberna teUtil.java:12)
    at com.author.app. Abhi.main(Abhi. java:13)

    Configuration file looks like this

    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration SYSTEM "hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
    <session-factory>
    <!-- Database connection settings -->
    <property name="connectio n.driver_class" >oracle.jdbc.Or acleDriver</property>
    <property name="connectio n.url">jdbc:ora cle:thin:@10.20 8.7.35:1521:SAP ETRM</property>
    <property name="connectio n.username">sap etrmdev</property>
    <property name="connectio n.password">sap etrmdev</property>
    <!-- JDBC connection pool (use the built-in) -->
    <property name="connectio n.pool_size">1</property>
    <!-- Enable Hibernate's automatic session context management -->
    <property name="current_s ession_context_ class">thread</property>
    <!-- SQL dialect -->
    <property name="dialect"> org.hibernate.d ialect.Oracle9D ialect</property>
    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql" >true</property>
    <mapping resource="conf/Trader.hbm.xml"/>
    </session-factory>
    </hibernate-configuration>

    Hibernate Util file where i am creating Connection Looks likes this...

    package com.author.hbn;

    import org.hibernate.S essionFactory;
    import org.hibernate.c fg.Configuratio n;
    import org.dom4j.*;
    public class HibernateUtil {
    private static final SessionFactory sessionFactory;

    static {
    try {
    // Create the SessionFactory from hibernate.cfg.x ml
    sessionFactory = new Configuration() .configure().bu ildSessionFacto ry();
    } catch (Exception ex) {
    // Make sure you log the exception, as it might be swallowed

    System.err.prin tln("Initial SessionFactory creation failed." + ex);
    throw new ExceptionInInit ializerError(ex );

    }
    }

    public static SessionFactory getSessionFacto ry() {
    return sessionFactory;
    }


    }
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    It has nothing to do with Hibernate nor Connections; read the exception text: your
    code is looking for a LogFactory and you didn't tell it where it could find one.

    kind regards,

    Jos

    Comment

    Working...