Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Starting Hibernate

 
joseph prabhu
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am starting Hibernate , i am getting the exception as

INFO: Configuration resource: /hibernate.cfg.xml
Error in initialiazation
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.enterprise.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
at com.enterprise.startup.CourseMain.saveCourse(CourseMain.java:19)
at com.enterprise.startup.CourseMain.main(CourseMain.java:12)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1411)
at com.enterprise.util.HibernateUtil.<clinit>(HibernateUtil.java:9)
... 2 more
Caused by: org.dom4j.DocumentException: http://www.jboss.org/dtd/hibernate/%20hibernate-configuration-3.0.dtd Nested exception: http://www.jboss.org/dtd/hibernate/%20hibernate-configuration-3.0.dtd
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481)
... 5 more


My Hibernate.cfg.xml file is as follows

<?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>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url"> jdbcracle:thin:@localhost:port/DB</property>
<property name="hibernate.connection.username">system</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect"> org.hibernate.dialect.Oracle10gDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="com/enterprise/config/tutorial.hbm.xml"/>
</session-factory>
</hibernate-configuration>

my classpath from eclipse is

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/transactions-jta.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/asm.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/atomikos-util.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/cglib-2.1.3.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/commons-collections-2.1.1.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/derby-10.2.2.0.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/derbytools-10.2.2.0.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/hibernate3.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/jta.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/naming-factory.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/naming-resources.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/transactions.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/transactions-api.jar"/>
<classpathentry kind="lib" path="D:/Java Material/HibernateLib/hibernate3.1/lib/transactions-hibernate3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

The directory structure is attached

Please help me where i commited mistake.



HibernateDirectoryStructure.jpg
[Thumbnail for HibernateDirectoryStructure.jpg]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic