-->
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.  [ 5 posts ] 
Author Message
 Post subject: hibernate.cfg.xml not found
PostPosted: Sun Aug 21, 2005 5:37 am 
Newbie

Joined: Wed Jan 19, 2005 6:41 am
Posts: 7
hi...
i write a web application that use hibernate .
in code i write
Configuration cfg = new Configuration();
sessionFactory = cfg.configure().buildSessionFactory();
but throw Exception that hibernate.cfg.xml not found .

where is this file.
thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 6:39 am 
Beginner
Beginner

Joined: Wed Jun 08, 2005 10:01 am
Posts: 22
Location: Italy
Hi,
are you using tomcat?
Put it into WEB-INF/classes

Bye
Nic


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 6:46 am 
Newbie

Joined: Wed Jan 19, 2005 6:41 am
Posts: 7
hi.
i use tomcat and place it in web-inf/classes
bu no correct.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 1:22 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
When you say web-inf/classes, do you mean WEB-INF/classes ? Check the exact spelling of the file name as well.


Top
 Profile  
 
 Post subject: Re: hibernate.cfg.xml not found
PostPosted: Mon Aug 22, 2005 1:34 am 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
stu_zamani wrote:
hi...
i write a web application that use hibernate .
in code i write
Configuration cfg = new Configuration();
sessionFactory = cfg.configure().buildSessionFactory();
but throw Exception that hibernate.cfg.xml not found .

where is this file.
thanks


How are you deploying with TOMCAT ? If you are working in a raw enviroment with in unpacked WAR then "WEB-INF/classes/hibernate.cfg.xml" should work for you, this may become a full system pathname like this /opt/jakarta-tomcat-5.5.9/webapps/your-context/WEB-INF/classes/hibernate.cfg.xml

If you are working through an IDE (Eclipse,Intelij) that auto-deploys your web-app then you should generally create the file hibernate.cfg.xml at the toplevel directory if your source tree.

An example file for hibernate 3.0.5 might look like this:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
     <session-factory>
        <!-- <property name="connection.datasource">java:comp/env/jdbc/tomcat_test</property> -->

        <!-- Mapping files -->
        <!-- <mapping resource="com/domain/empty.hbm.xml"/> -->
    </session-factory>
</hibernate-configuration>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.