-->
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.  [ 1 post ] 
Author Message
 Post subject: HibernateException: /hibernate.cfg.xml not found
PostPosted: Fri Jul 14, 2006 5:08 am 
Newbie

Joined: Fri Jul 14, 2006 4:45 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.01

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="Object1" table="Object1">
<id name="id" column="ID">
<generator class="increment"/>
</id>
<property name="property1"/>
<property name="property2"/>
<property name="property3"/>
<property name="property4"/>
<property name="property5"/>
</class>

</hibernate-mapping>

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

SessionFactory sessionFactory =
new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();

Object1 object1 = new Object1();
object1.setProperty1("Value1");
object1.setProperty2("Value2");
object1.setProperty3("Value3");
object1.setProperty4("Value4");
object1.setProperty5("Value5");

session.save(object1);
session.getTransaction().commit();

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" org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1287)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1309)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at examples.PersistenceTest.main(PersistenceTest.java:22)

Name and version of the database you are using:
Derby 10.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:




Hi, I don't succeed to start with hibernate.
I had write this simple program and I had put hibernate.cfg.xml in the same directory of source and class file.
The result is: HibernateException: /hibernate.cfg.xml not found
Can you help me?
Thank You so much


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.