-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate.cfg.xml not found
PostPosted: Wed Oct 19, 2005 12:27 pm 
Newbie

Joined: Wed Oct 19, 2005 12:02 pm
Posts: 5
Location: Woodland Hills, CA
Hi,

I am new to Hibernate and am trying to build a test program to run. When I call Configuration's config method, I receive an exception say that it cannot find hibernate.cfg.xml. I went under my user environment variables and added the location to the classpath, but I still receive the same results

Does anyone have any ideas?

Thank you in advance,

Greg


Top
 Profile  
 
 Post subject: classpath
PostPosted: Wed Oct 19, 2005 12:50 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
The fact that your location is in an environment variable (I presume CLASSPATH) does not mean that your runtime uses it. And for very good reasons!

It is a common (and very good) practice for Java processes to setup Java classpath in the command line via –cp option. Please consult your tool (presumably IDE) how to setup classpath there.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 12:58 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 9:20 pm
Posts: 36
Location: Vancouver, WA
I am not sure what is going on in your environment. Seems to be your class path still is not set properly. Try something like that

Code:

Configuration dbConfig = new Configuration();
dbConfig.configure(this.getClass().getResource(hibernate_cfg_xml_file));



or/and put config file in root of your package.

if it does not work, you for sure have wrong class path set

Basil

_________________
Vasyl Zhabko


Top
 Profile  
 
 Post subject: Hibernate.cfg.xml not found
PostPosted: Wed Oct 19, 2005 1:17 pm 
Newbie

Joined: Wed Oct 19, 2005 12:02 pm
Posts: 5
Location: Woodland Hills, CA
Thank you both. This did the trick

Greg


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.