Error In Creating Session Factory Object./hibernate.cfg.xml Not Found
Contents |
here for a quick overview of hibernate.cfg.xml not found eclipse the site Help Center Detailed answers to any questions org.hibernate.hibernateexception hibernate.cfg.xml not found eclipse you might have Meta Discuss the workings and policies of this site About could not locate cfg.xml resource Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Org.hibernate.internal.util.config.configurationexception: Could Not Locate Cfg.xml Resource
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up org.hibernate.HibernateException: /hibernate.cfg.xml not found up vote hibernate.cfg.xml not found maven 8 down vote favorite 3 I'm trying to use hibernate with spring 3 mvc but at the moment I get this exception thrown. I think I need to define my hibernate.cfg.xml somewhere, but not sure where? I basically followed this example here http://www.nabeelalimemon.com/blog/2010/05/spring-3-integrated-with-hibernate-part-a/ And in particularly saw this line of code there that suppose to "magically" find my hibernate.cfg file using this: return new Configuration().configure().buildSessionFactory(); I'm guessing that is not correct? i currently have my hibernate.cfg file inside src/com/jr/hibernate/ below is my cfg file:
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About http://stackoverflow.com/questions/12677783/where-to-place-hibernate-cfg-xml Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack https://coderanch.com/t/215954/ORM/databases/hibernate-cfg-xml Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Where to place hibernate.cfg.xml? up vote 25 not found down vote favorite 4 My project is like this: /src/main/java -thegamers -app.java -hibernateutil.java can someone tell me where to put the hibernate.cfg.xml? because I'm getting this error: Initial SessionFactory creation failed.org.hibernate.HibernateException: hibernate.cfg.xml not found Exception in thread "main" java.lang.ExceptionInInitializerError at thegamers.HibernateUtil.buildSessionFactory(HibernateUtil.java:17) at thegamers.HibernateUtil.
This Site Careers Other all forums Forum: Object Relational Mapping hibernate.cfg.xml not found Danny Rebello Greenhorn Posts: 6 posted 10 years ago Hi All, I am working on websphere 4 and have created a Java application. My root folder is FirstHibernateExample and it is under C:\danny\hibernate\FirstHibernateExample\ my java,class and xml files are under C:\danny\hibernate\FirstHibernateExample\src\com\test\example\ When I compile the java files everything is fine. When I run the application I get the following error : net.sf.hibernate.HibernateException: hibernate.cfg.xml not found. In my code I have specified private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml"; I have tried placing the hibernate.cfg.xml in all the locations , but still the error exists. Can Someone help me on this Thanks in Advance Regards Danny Jeff Albertson Ranch Hand Posts: 1780 posted 10 years ago The simplest thing to do is put your hibernate.cfg.xml file in your src folder (check that your build process copies it to a similar location wrt class files in your directory structure/jar/war etc...) and implicitly access it via the no-argument configure method:...new Configuration().configure().buildSessionFactory()...There's no need to mention a path in your code -- this is the default location. There is no emoticon for what I am feeling! prashant sable Greenhorn Posts: 3 posted 10 years ago I kept Hibernate-cf.... in classes folder (in webapp since it was struts application), and it worked. -prashant Danny Rebello Greenhorn Posts: 6 posted 10 years ago I have added the following code : new Configuration().configure().buildSessionFactory(); but still the error : net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found is getting displayed Regards Danny garth schneider Ranch Hand Posts: 95 posted 10 years ago I am in the ejb container of Websphere 5.0.2.3 and can not find where to put the hibernate.cfg.xml file. Is this a websphere issue? I have worked a full 2 days on this and can not figure out what to do. 1/31/06 20:18:38:334 CST] 785e785e SystemOut O Exception creating SessionFactory object: /hibernate.cfg.xml not found [1/31/06 20:18:42:781 CST] 785e785e Configuration I net.sf.hibernate.cfg.Configuration configuring from resource: /hibernate.cfg.xml [1/31/06 20:18:42:781 CST] 785e785e Configuration I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml [1/31/06 20:18:42:781 CST] 785e785e Configuration W net.sf.hibernate.cfg.Configuration /hibernate.cfg.xml not found Garth IBM Certified Enterprise Dev