aspose file tools*
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Run first Hibernate example in eclipse" Watch "Run first Hibernate example in eclipse" New topic
Author

Run first Hibernate example in eclipse

pravin gajbhiye
Greenhorn

Joined: Aug 20, 2012
Posts: 21
Hi
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 - hibernate.properties 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 failed.org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtil.buildSessionFactory(HibernateUtil.java:15)
at HibernateUtil.<clinit>(HibernateUtil.java:6)
at Test.addUser(Test.java:59)
at Test.main(Test.java:18)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at HibernateUtil.buildSessionFactory(HibernateUtil.java:10)
... 3 more
Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exception: www.hibernate.org
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 6 more

I am using:

hibernate-release-4.1.9.Final
slf4j-1.7.2

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

Joined: Aug 16, 2005
Posts: 14107
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
pravin gajbhiye
Greenhorn

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


Actually I don't know which jar files are needed .
I am reffering the link http://blog.sencide.com/2011/03/hibernate-tutorial-for-beginners.html. 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
2)commons-collections-3.2.1.jar
3)jta-1.1.jar
So i downloaded these saperatly and add these as external jar files.


hibernate-release-4.1.9.Final contains
antlr-2.7.7
dom4j-1.6.1
hibernate-commons-annotations-4.0.1.Final
hibernate-core-4.1.9.Final
hibernate-jpa-2.0-api-1.0.1.Final
javassist-3.17.1-GA
jboss-logging-3.1.0.GA
jboss-transaction-api_1.1_spec-1.0.0.Final

I also downloaded
slf4j-1.7.2 folder which contains jars.
hibernate3.jar
mysql-connecter-java5.1.jar
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
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
Question too difficult for this forum: moving to where we usually discuss Hibernate.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Run first Hibernate example in eclipse