-->
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.  [ 6 posts ] 
Author Message
 Post subject: Help please - hibernate.cfg.xml not found
PostPosted: Mon Feb 19, 2007 7:51 am 
Newbie

Joined: Mon Feb 19, 2007 6:31 am
Posts: 12
Can someone please help me?
i get this error message when i run my app. the hibernate.cfg.xml file is located in my src directory

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found
Exception in thread "main" java.lang.ExceptionInInitializerError
at hello.HibernateUtil.<clinit>(HibernateUtil.java:18)
at hello.HelloWorld.main(HelloWorld.java:16)
Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1205)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1229)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at hello.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 1 more

Avesh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 19, 2007 12:58 pm 
Newbie

Joined: Thu Feb 15, 2007 6:09 pm
Posts: 7
hi, i have the same problem and dont know how to solve it. it occurs when i use the newest versions of hibernate, hibernate utils and mysql driver.

Did you find a solution?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 19, 2007 2:46 pm 
Regular
Regular

Joined: Sun Sep 17, 2006 2:48 am
Posts: 81
Location: California
Is the configuration file there in your classpath?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 9:17 am 
Newbie

Joined: Thu Feb 15, 2007 6:09 pm
Posts: 7
hi, thanks for your answer.

the cfg file is allready set and even when i set the classpath it wont run.

when i use the tutorial http://www.hibernate.org/hib_docs/v3/re ... orial.html

with a small modification it gives me the same error (i dont understand that because the tutorial should work)

i use hibernate 3.2 and a mysql database

the code:

public class Main {

public static void main(String[] args) {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();

session.beginTransaction();

Projekt theEvent = new Projekt();
theEvent.setProjektnameGer("dsfakjdl");


session.save(theEvent);

session.getTransaction().commit();

HibernateUtil.getSessionFactory().close();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 6:01 pm 
Newbie

Joined: Tue Feb 20, 2007 5:58 pm
Posts: 1
try including (manually though for testing purpose) the cfg file in classes folder and run. Looks like somehow this is not present in there.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 21, 2007 2:10 am 
Newbie

Joined: Thu Feb 15, 2007 6:09 pm
Posts: 7
ok i found the mistake. when creating the config and the source hibernate / hibernate tools forgets to set the following line

<property name="current_session_context_class">thread</property>

it also forgets the mapping files ...

when the line is inserted the conifg will be found

thanks anyway


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