Joined: Fri Jan 28, 2011 2:45 am Posts: 4
|
hi I am new to Hibernate and was following the hibernate reference pdf.
can any body help me on this .
i paste the cfg file and the hbm.xml
i use Oracle 10g as DB and JDBC version is 9
But i am able to locate the logfactory class with the commonslogging jar.
as i followed and built a sample,it throws the following error
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory Exception in thread "main" java.lang.ExceptionInInitializerError at util.HibernateUtil.<clinit>(HibernateUtil.java:17) at events.EventManager.createAndStoreEvent(EventManager.java:15) at events.EventManager.main(EventManager.java:40) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:110) at util.HibernateUtil.<clinit>(HibernateUtil.java:11) ... 2 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory 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) ... 4 more
************************************************** cfg.xml **********************************************
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration> <session-factory> <!--Database Settings --> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="connection.url">jdbc:oracle:thin:localhost:1521:orcl</property> <property name="connection.username">scott</property> <property name="connection.password">test</property> <!-- JDBC connection pool (use the built-in) --> <property name="connection.pool_size">1</property> <!-- SQL Dialect --> <property name = "dialect">org.hibernate.dialect.OracleDialect</property> <property name="current_session_context_class">jta</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
<mapping resource="events/hbm.xml"/> </session-factory> </hibernate-configuration>
******************************************************************* hbm.xml *******************************************************************
<?xml version="1.0" encoding="UTF-8"?> <!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>
|
|