-->
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: hibernate.cfg.xml not found
PostPosted: Sat Apr 23, 2005 6:04 pm 
Newbie

Joined: Fri Feb 25, 2005 10:59 am
Posts: 4
I have hibernate.cfg.xml in web-inf.

I initialise hibernate with:

Configuration cfg = new Configuration();
cfg.configure(realPath + "WEB-INF\\hibernate.cfg.xml");
SessionFactory sessions = cfg.buildSessionFactory();

Im still getting this error:

[2005-04-23 22:18:06.296] initializing application http://localhost:9999/jspforums
net.sf.hibernate.HibernateException: C:\Documents and Settings\Dave\My Documents\WebSites\MyWeb\web\webapps\jspforums\WEB-INF\hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:849)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:873)
at uk.co.davidjc.jspforums.init.ServletContextInit.contextInitialized(ServletContextInit.java:43)


Even though the file exists at that location, it is saying it cant find it??

Ive tried using the classpath method of loading too, and i get the same error.

Im using Resin 2.1.12.

Thanks
Dave


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2005 6:31 pm 
Newbie

Joined: Fri Feb 25, 2005 10:59 am
Posts: 4
I used this instead:

cfg.configure(new File(realPath + "WEB-INF\\hibernate.cfg.xml"));


That fixed it.


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.