-->
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.  [ 2 posts ] 
Author Message
 Post subject: cannot load hibernate.cfg.xml with tomcat
PostPosted: Fri Jan 21, 2005 7:44 am 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
I try to configure my sessionFactory using hibernate.cfg.xml and
File file = new File(absolutePath+"hibernate.cfg.xml");
session = new Configuration().configure(file).buildSessionFactory().openSession();

But it always throws me an net.sf.hibernate.cfg.Configuration exception and it said it cannot find absolutePath+"hibernate.cfg.xml").
I'm using Tomcat for this webapps.Is tomcat able to load absolute path during webapps runtime?
Any help colud be appreciated
Regards


Top
 Profile  
 
 Post subject: Re: cannot load hibernate.cfg.xml with tomcat
PostPosted: Sat Feb 19, 2005 4:04 pm 
Newbie

Joined: Sat Jan 15, 2005 9:17 am
Posts: 10
dilembo wrote:
I try to configure my sessionFactory using hibernate.cfg.xml and
File file = new File(absolutePath+"hibernate.cfg.xml");
session = new Configuration().configure(file).buildSessionFactory().openSession();

But it always throws me an net.sf.hibernate.cfg.Configuration exception and it said it cannot find absolutePath+"hibernate.cfg.xml").
I'm using Tomcat for this webapps.Is tomcat able to load absolute path during webapps runtime?
Any help colud be appreciated
Regards


I had the problem the other way around:
configure( ) w/o args would not work with Tomcat even though I placed hibernate.cfg.xml in WEB-INF/classes as per the documentation.
Tomcat complained of being unable to find it. Same went for log4j.properties.

I did manage to pass in an absolute path though as a workaround.

It was a frustrating 24+ hours to track it down and how I managed to get configure( ) to work without arguments [no pun intended] is when the idea
of trying a different machine altogether led me to packaging the app as a WAR and installing it under <CATALINA_HOME>/webapps/<app_folder>
instead of G:\\myWebApp.

I don't know if it's a bug or if a custom-made Context requires further attributes that I'm unaware of for resources in its WEB-INF/classes to be
seen by Tomcat. I've had enough of configuration and setup details right now.

So, if you're using Tomcat's webapps folder, try configure( ) , otherwise I'm afraid I need to borrow the least bad line from Constantine:
Gabriel's "You're fucked!"

Rico.


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