-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: hibernate.cfg.xml not found?
PostPosted: Fri Nov 05, 2004 7:03 pm 
Newbie

Joined: Mon Aug 30, 2004 6:12 pm
Posts: 2
Location: Dallas
Hello All,

I'm working on deploying a hibernate web application and when I invoke the HibernateUtil class from the CaveatEmptor sample, I'm getting a
"HibernateException: /hibernate.cfg.xml not found" exception.

Any ideas?

Thanks for any help!

Steven


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 06, 2004 2:48 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Is this file in the root of your classpath?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 22, 2006 6:29 am 
Newbie

Joined: Mon Oct 23, 2006 12:27 am
Posts: 4
Location: sri lanaka
waht is the root of the class path mean....?? please explain it in directory structure

thanks..

_________________
R P Janaka Priyadarshana
Dept Of Computer Science & Engineering
University Of Moratuwa
Moratuwa
Sri Lanka.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 22, 2006 7:16 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please download the sample chapter 2 of Java Persistence with Hibernate and work through this Hello World example. Also consider reading a Java Beginners book.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 1:36 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
christian wrote:
Please download the sample chapter 2 of Java Persistence with Hibernate and work through this Hello World example. Also consider reading a Java Beginners book.


Actually do it the other way around :-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 4:36 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
hi! StevenLeija!

I faced the same problem few weeks ago.

But I got the solution.

put the hibernate.cfg.xml in web-inf/classes folder.
Then your application will find the file.

If this solves your problem then please don't forget to credit my reply.

Take care!
Bye!

_________________
Thanks & Regards
Sumit Tyagi.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 06, 2006 3:50 pm 
Newbie

Joined: Wed Dec 06, 2006 3:45 pm
Posts: 1
I had the same problem, and the above worked for me, thanks sumittyagi.


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found?
PostPosted: Wed Jul 15, 2009 12:17 pm 
Newbie

Joined: Tue Jul 14, 2009 3:34 pm
Posts: 2
That worked for me too, in Eclipse Ganymede. Weird, huh?


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found?
PostPosted: Mon Aug 03, 2009 12:53 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
HernisQ wrote:
That worked for me too, in Eclipse Ganymede. Weird, huh?


no, it's not weird at all.


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found?
PostPosted: Thu Feb 25, 2010 11:12 am 
Newbie

Joined: Thu Feb 25, 2010 11:09 am
Posts: 7
Thanks for the web-inf/classes tip. Just curious though, why do you have to create a folder for it to be found? Could anyone explain this please?


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found?
PostPosted: Tue Mar 02, 2010 2:42 am 
Newbie

Joined: Tue Mar 02, 2010 2:31 am
Posts: 1
Hi.
for NetBeans
Do one thing.
Just put your ".XML" file in to src folder rather than src/'Project name'/ ' '.xml.


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found?
PostPosted: Thu Mar 18, 2010 11:55 am 
Newbie

Joined: Thu Mar 18, 2010 11:40 am
Posts: 1
Rode wrote:
Thanks for the web-inf/classes tip. Just curious though, why do you have to create a folder for it to be found? Could anyone explain this please?


WEB-INF/classes folder is in the classpath by default in web applications. So if you place any class file or resource (.xml or any other) file we can load it easily with Class.getResourceAsStream() or ClassLoader.getResource... like methods.

In such cases jvm will search all the class paths for the specified files, we no need to specify exact path of the file.
Hibernate also loads the files in such a way, so it works.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.