-->
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.  [ 9 posts ] 
Author Message
 Post subject: Where exactly should hibernate.cfg.xml be?
PostPosted: Tue Dec 30, 2003 7:01 am 
Newbie

Joined: Mon Dec 29, 2003 10:45 am
Posts: 12
Hi,
I've tried these:

- / (the root of my web-app)
- /WEB-INF/
- /WEB-INF/classes

but none of them works, I always get "/hibernate.cfg.xml not
found"

thanks,
Jari


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:13 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Exactly, it has to be seen by the classloader that load Hibernate.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
/WEB-INF/classes should work


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
depends of your servlet container

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:41 am 
Newbie

Joined: Mon Dec 29, 2003 10:45 am
Posts: 12
epbernard wrote:
depends of your servlet container


Tomcat 5.0.16


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Are your library files in /WEB-INF/lib ? Your hibernate.cfg.xml should be in /WEB-INF/classes, I am pretty sure. What call do you use to configure hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:46 am 
Newbie

Joined: Mon Dec 29, 2003 10:45 am
Posts: 12
gloeglm wrote:
Are your library files in /WEB-INF/lib ? Your hibernate.cfg.xml should be in /WEB-INF/classes, I am pretty sure. What call do you use to configure hibernate?


Yes, they are in WEB-INF/lib and hibernate.cfg.xml is in WEB-INF/classes. I use
Code:
sessionFactory = new Configuration().configure().buildSessionFactory();

to configure.

Jari


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 30, 2003 9:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hm, this sould work in my oppinion, have you tried something like

Code:
Configuration.configure(this.class.getClassLoader().getResource("hibernate.cfg.xml"));

or something like that ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 31, 2003 3:42 am 
Newbie

Joined: Mon Dec 29, 2003 10:45 am
Posts: 12
gloeglm wrote:
Hm, this sould work in my oppinion, have you tried something like

Code:
Configuration.configure(this.class.getClassLoader().getResource("hibernate.cfg.xml"));

or something like that ...

Thanks a lot, that does it. Very strange thing is that yesterday when I compiled the application in JBuilder, it worked well, hibernate and all, but compiling it with Ant caused the "not found". The war's themselves were identical except some included libraries. Well, live and learn.

thanks again,
Jari


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