• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Please help:

hibernate.cfg.xml is as follows:



Main class "HibernateTest" is as follows:


Thanks in advance

 
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
reply
    Bookmark Topic Watch Topic
  • New Topic