File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Nimu Chox
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Please help:

hibernate.cfg.xml is as follows:



Main class "HibernateTest" is as follows:


Thanks in advance

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check where is your hibernate.cfg.xml located. Also include mapping tag in your hibernate.cfg.xml, for the hbm file
 
Nimu Chox
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


..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
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..Hello,

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

Thanks.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic