facebook

Issues running Hibernate Quickstart Tutorial

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #233171 Reply

    bucknell
    Member

    I have recently installed Myeclipse 4.0M2 build 20050627-4.0-milestone2 on a new installation of Eclipse 3.1.0 build I20050610-1757 all running on Windows XP professional with JDK 1.4.2_08. On running the Hibernate Quickstart tutorial I get hte following error message:

    log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).

    log4j:WARN Please initialize the log4j system properly.

    %%%% Error Creating SessionFactory %%%%

    net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found

    at net.sf.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:886)

    at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:910)

    at com.genuitec.hibernate.SessionManager.currentSession(SessionManager.java:48)

    at com.genuitec.hibernate.HBTest.main(HBTest.java:18)

    java.lang.NullPointerException

    at com.genuitec.hibernate.SessionManager.currentSession(SessionManager.java:56)

    at com.genuitec.hibernate.HBTest.main(HBTest.java:18)

    Exception in thread “main”

    The hibernate.cfg.xml file is in the default location, but I have also tried copying it to other locations and also hard coding the file path in the call from the SessionManager, without success. I have created a normal FileReader in the SessionManager and used the CONFIG_FILE_LOCATION string to load the file location and this has worked without a problem. Any ideas?

    I have 4 plugins like “org.eclipse.pde.*

    #233239 Reply

    Riyad Kalla
    Member

    new installation of Eclipse 3.1.0 build I20050610-1757

    This isn’t the final GA build of Eclipse 3.1, be sure to download and use the final 3.1 release when you get a chance.

    Please describe if this is a Java or Web project, and where the hibernate.cfg.xml file lives and what your src and output dirs are set to.

    #233248 Reply

    bucknell
    Member

    Riyad,
    This is a Java project as per the Hibernate Quickstart tutorial with standard src and bin directories. The hibernate.cfg.xml file resides in the src directory (the default location). What is confusing me is that I can access the file using a normal FileReader and the CONFIG_FILE_LOCATION string, but the Configuration object appears not to find it.

    Allan

    #233259 Reply

    Riyad Kalla
    Member

    Are you executing this in an app server? I ask because I noticed the line:

    
     at com.genuitec.hibernate.HBTest.main(HBTest.java:18) 
    

    which suggests you wrote your own test class… however if this was being executed from within an app server, it should all run without a problem, if you are running it from outside the app server I believe your ClassLoader resource paths are going to be different because your working dir is different. This may be your issue.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Issues running Hibernate Quickstart Tutorial

You must be logged in to post in the forum log in