-->
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: Problem finding the configuration file
PostPosted: Tue Mar 21, 2006 8:20 am 
Newbie

Joined: Tue Mar 21, 2006 8:09 am
Posts: 1
Hi,
I was using hibernate whitout problems just a few days ago.
I then decided to implement RMI for client-server architecture and hibernate started giving me problems finding the configuration file.
It's like if it doesn't see it. This is the line that gives the error:
sessionFactory = new Configuration().configure("server/database/hibernate.cfg.xml").buildSessionFactory();

I cheked in the src and bin and the files or still there.
just have no clue wy it's not working any more.

any help would be great. Thanks.
Filippo

Hibernate version: 3.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

sessionFactory = new Configuration().configure("server/database/hibernate.cfg.xml").buildSessionFactory();



Full stack trace of any exception that occurs:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
at server.database.HibernateSimpleCommands.find(HibernateSimpleCommands.java:131)
at server.database.Read.getAeroporti(Read.java:195)
at server.web.WebServer.<init>(WebServer.java:32)
at server.web.WebServer.getWebServer(WebServer.java:40)
at server.TheServer.main(TheServer.java:28)

Caused by: java.lang.RuntimeException: Configuration problem: server/database/hibernate.cfg.xml not found
at server.database.HibernateUtil.<clinit>(HibernateUtil.java:16)
... 5 more

Caused by: org.hibernate.HibernateException: server/database/hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1275)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1297)
at server.database.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 5 more


Name and version of the database you are using: Mysql


Top
 Profile  
 
 Post subject: Re: Problem finding the configuration file
PostPosted: Tue Mar 21, 2006 9:30 am 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
Hello:

I think that you put correct your file at same path. But, your application server can not seek that file when you wrote absolute path.

In your application folder, you may have src, bin, "server", and so on. In this case, you have to put the line like follow:

sessionFactory = new Configuration().configure("../server/database/hibernate.cfg.xml").buildSessionFactory();


I holp this post get you started your Hibernate session Factory.

request for comments.

Recards.

Neketsu Shonen


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.