aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate:error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
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: 622
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: 622
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://aspose.com/file-tools
 
subject: Hibernate:error "org.hibernate.HibernateException: /hibernate.cfg.xml not found"