Meaningless Drivel is fun!
The moose likes Object Relational Mapping and the fly likes Run first Hibernate example in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Run first Hibernate example in eclipse" Watch "Run first Hibernate example in eclipse" New topic

Run first Hibernate example in eclipse

pravin gajbhiye

Joined: Aug 20, 2012
Posts: 21
I just started reading Hibernate
and did one application.
But I got error..
[main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
[main] INFO org.hibernate.cfg.Environment - not found
[main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
[main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
[main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
Initial SessionFactory creation Could not parse configuration: /hibernate.cfg.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtil.buildSessionFactory(
at HibernateUtil.<clinit>(
at Test.addUser(
at Test.main(
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(
at org.hibernate.cfg.Configuration.configure(
at org.hibernate.cfg.Configuration.configure(
at HibernateUtil.buildSessionFactory(
... 3 more
Caused by: org.dom4j.DocumentException: Nested exception:
at org.hibernate.cfg.Configuration.doConfigure(
... 6 more

I am using:


Please anybody help me , I am new for Hibernate
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14998

This error message:
Could not parse configuration: /hibernate.cfg.xml

sounds like there is something wrong with your Hibernate configuration file. Maybe it is not a valid XML file. Check if the content of the file is valid XML and if it's a valid Hibernate configuration file.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
pravin gajbhiye

Joined: Aug 20, 2012
Posts: 21
Thanks Jesper...

Actually I don't know which jar files are needed .
I am reffering the link for learning basic application.
I have downloaded hibernate-release-4.1.9.Final .
But it dosn't have the files
1) cglib-2.2.2.jar
So i downloaded these saperatly and add these as external jar files.

hibernate-release-4.1.9.Final contains

I also downloaded
slf4j-1.7.2 folder which contains jars.
and it.

Is there any problems with my setup?

Please give me a proper set configuration.
Thank you very much for your reply.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44538
Question too difficult for this forum: moving to where we usually discuss Hibernate.
I agree. Here's the link:
subject: Run first Hibernate example in eclipse
It's not a secret anymore!