-->
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: Fri Nov 16, 2007 12:08 pm 
Newbie

Joined: Fri Nov 16, 2007 11:57 am
Posts: 2
Hi Friends,

I am new to hibernate. I downloaded example from Hybernate.org and tring to execute FirstExample.java.

This program executed fine for some time but now its started giving problem.

getting Exception

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1205)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1229)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:21)
Exception in thread "main" java.lang.NullPointerException
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:39)
/hibernate.cfg.xml not found


I dont know where to set the hibernate.cfg.xml location in project.

Please let me know if anyone else has similer problem or knows anything regarding this.

Thanks in advance
Sonal


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 16, 2007 3:31 pm 
Newbie

Joined: Wed Dec 28, 2005 5:44 am
Posts: 12
Hi Sonal.

Currently where is your config file?

Try to place it inside WEB-INF/Classes..should work..

Regards,
MJ


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 16, 2007 10:20 pm 
Newbie

Joined: Fri Nov 16, 2007 11:57 am
Posts: 2
Hi MJ,

My Project is not J2EE based, its a core java project. Any ways thanks for help.
I Got the solution of my problem.

Problem was the location of hibernate.cfh.xml. By default Configration class take hibernate file location as /hibernate.cfg.xml which means the root of project. So knowing this we always put file in root of project.

But problem comes of our source and binary locations are different. so all configuration files should copy to binary locations (in war file or web-inf.classes) or actual binary location in case of core java based projects.

Any ways My problem got problem solved.
Thanks
Sonal


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 5:21 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
it should be at the root of your classpath, which is not necessarilly the root of your project.
Unless you explicitly point your application to a specific config file of course.


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.