Hibernate.cfg.xml Not Found Error In Eclipse
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have hibernate.cfg.xml not found maven Meta Discuss the workings and policies of this site About Us hibernate.cfg.xml not found in netbeans Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
Caused By: Org.hibernate.hibernateexception: /hibernate.cfg.xml Not Found
us Stack Overflow Questions 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
Hibernate.cfg.xml Not Found Maven Project
like you, helping each other. Join them; it only takes a minute: Sign up Error: /hibernate.cfg.xml not found up vote 0 down vote favorite I am using Eclipse "Indigo". I made a Java Project with the following Structure: Hibernate (Project Name) src Referenced Libraries JRE System Libraries employee.hbm.xml hibernate.cfg.xml Now when I am running my code its exception in thread "main" org.hibernate.mappingexception: invalid configuration showing error "/hibernate.cfg.xml not found" Is there a way to set a path for hibernate configuration file?? java eclipse hibernate share|improve this question edited Jul 16 '12 at 6:52 Zamani 260215 asked Jul 16 '12 at 6:29 gauravoli 4228 add a comment| 3 Answers 3 active oldest votes up vote 1 down vote accepted Its obviously a wrong setup. You can get a detailed explanations by searching in google how to setup eclipse to work with hibernate. There are even video tutorials about this. Like this one :) Good luck share|improve this answer edited Oct 30 '12 at 14:14 answered Jul 16 '12 at 6:37 Mark Bramnik 6,34621125 Thanks Mate, These tutorials are really helpful :) –gauravoli Oct 30 '12 at 12:29 add a comment| up vote 5 down vote You must put hibernate.cfg.xml into src directory (in the same folder that your packages or class). src/ com.mypackage/myJava.java com.otherPackage hibernate.cfg.xml In addition, in eclipse you can define a resources directory, add it to the pat
here for a quick overview
Hibernate.cfg.xml Example
of the site Help Center Detailed answers to hibernate.properties not found any questions you might have Meta Discuss the workings and policies of this org hibernate mappingexception unknown entity site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack http://stackoverflow.com/questions/11499104/error-hibernate-cfg-xml-not-found Overflow Questions 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 Hibernate exception hibernate.cfg.xml http://stackoverflow.com/questions/15258594/hibernate-exception-hibernate-cfg-xml-not-found not found up vote 4 down vote favorite 2 I'm trying to start project with Hibernate and Maven. I got such exception: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2176) at org.hibernate.cfg.Configuration.configure(Configuration.java:2157) at org.hibernate.cfg.Configuration.configure(Configuration.java:2137) at FirstHibernate.com.myhib.CRUDS.CrudsOps.main(CrudsOps.java:15) Here is the screenshot of my project structure, (hibernate.cfg.xml is in src/): http://imageshack.us/photo/my-images/692/screenshotxba.jpg/ CrudsOps.java package FirstHibernate.com.myhib.CRUDS; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class CrudsOps { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub SessionFactory sf = new Configuration().configure().buildSessionFactory(); System.out.println("Cfg and hbm files loaded succesfully"); Session session = sf.openSession(); session.beginTransaction(); System.out.println("Transaction began"); } } pom.xml
and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor. Announcement Announcement Module Collapse No announcement yet. a simple problem need hlep--"hibernate.cfg.xml" NOT Found :( Page Title Module Move Remove Collapse X Conversation Detail Module Collapse Posts Latest Activity Search Forums Page of 2 Filter Time All Time Today Last Week Last Month Show All Discussions only Photos only Videos only Links only Polls only Filtered by: Clear All new posts mellon Member Join Date: Feb 2009 Posts: 57 #16 Feb 26th, 2009, 10:43 AM Hi, vincent, I am sure there is no error when I start the server. and from the error msg: Code: INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found it seems it try to find the configuration file not from WEB-INF/hibernate.cfg.xml but from \hibernate.cfg.xml , it is just my guess... Comment Cancel Post vincent_ray21 Member Join Date: May 2007 Posts: 38 #17 Feb 26th, 2009, 10:53 AM Can you check your tomcat/webapps/