-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problems reading config file
PostPosted: Mon Aug 16, 2004 6:58 pm 
Newbie

Joined: Mon Aug 16, 2004 6:47 pm
Posts: 5
Hello,

I feel really stupid for asking, but I cannot read the config file on startup.
It is there with permissions. but I can't seem to load it.
I run Ecipse 3.0 release and when firing up I get the exception below.:

Code:
   public static void initialize (String configFileName) throws HibernateException {
      if (null == configFileName && sessionFactoryMap.size() > 0) return;
      else if (null != sessionFactoryMap.get(configFileName)) return;
      else {
         Configuration cfg = new Configuration();
         if (null == configFileName)
            cfg.configure();
         else
            cfg.configure(configFileName);
         setSessionFactory(configFileName, cfg.buildSessionFactory());
      }
   }


I am using Hibernate version: 2.1

Full stack trace of any exception that occurs:

Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Aug 17, 2004 12:29:52 AM net.sf.hibernate.cfg.Configuration getConfigurationInputStream
WARNING: /hibernate.cfg.xml not found
Exception in thread "main" net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found
at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:872)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:896)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
at se.fbio.hib.base._BaseRootDAO.initialize(_BaseRootDAO.java:51)
at se.fbio.hib.base._BaseRootDAO.initialize(_BaseRootDAO.java:38)
at testHib.main(testHib.java:35)


The file is there! What could be wrong? I have also tried absolute/relative path's.
I'm stuck. Could anyone assist me in this? Am I doing something stupid?

Regards,

.../Ola


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 7:17 pm 
Beginner
Beginner

Joined: Tue Dec 09, 2003 3:27 pm
Posts: 21
Quote:
It is there with permissions

and where would that be, in your classpath?

It would also help if you mention what you passed in for configFileName.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 17, 2004 6:50 am 
Senior
Senior

Joined: Fri Nov 21, 2003 5:55 am
Posts: 155
public static void initialize (String configFileName) throws HibernateException {
if (null == configFileName && sessionFactoryMap.size() > 0) return;
else if (null != sessionFactoryMap.get(configFileName)) return;
else {
Configuration cfg = new Configuration();
if (null == configFileName)
cfg.configure();
else
cfg.configure(configFileName);
setSessionFactory(configFileName, cfg.buildSessionFactory());
}
}

Your error is in red, Test the value of configFileName, I think it's null.


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