aspose file tools
The moose likes Object Relational Mapping and the fly likes Hibernate:error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate:error "org.hibernate.HibernateException: /hibernate.cfg.xml not found"" Watch "Hibernate:error "org.hibernate.HibernateException: /hibernate.cfg.xml not found"" New topic
Author

Hibernate:error "org.hibernate.HibernateException: /hibernate.cfg.xml not found"

Nimu Chox
Greenhorn

Joined: Mar 11, 2012
Posts: 27
Hello,

Please help:

hibernate.cfg.xml is as follows:



Main class "HibernateTest" is as follows:


Thanks in advance

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 609
Check where is your hibernate.cfg.xml located. Also include mapping tag in your hibernate.cfg.xml, for the hbm file


kunal
Nimu Chox
Greenhorn

Joined: Mar 11, 2012
Posts: 27


..the path is in src, I have tried to hardcode it in the main class as shown below, but I still get the error. Is there any other trick to check the path, thanks




Thank you in advance
Nimu Chox
Greenhorn

Joined: Mar 11, 2012
Posts: 27
..Hello,

This worked - put the "hibernate.properties" file in my "/src/java" directory.

Thanks.
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 609
Configuration configuration = new Configuration();
configuration.configure("src/hibernate.cfg.xml");


Configuration.configure() looks into the classpath, so need of src/hibernate.cfg.xml. Just go for

You can also do this : (with hibernate.cfg.xml, removing properties file)
Nimu Chox
Greenhorn

Joined: Mar 11, 2012
Posts: 27
Now I am getting this error: org.hibernate.HibernateException: could not instantiate RegionFactory [net.sf.ehcache.hibernate.EhCacheRegionFactory"]

..I have done the configuration for the region factory as follows

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate:error "org.hibernate.HibernateException: /hibernate.cfg.xml not found"
 
Similar Threads
Simple hibernate annotation example problem
basic app Hibernate
why it is inserting the values in the rows again
I'm not able to insert record in Derby using Hibernate
Could not parse configuration: /hibernate.cfg.xml