-->
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.  [ 5 posts ] 
Author Message
 Post subject: New to Hibernate
PostPosted: Fri Nov 11, 2005 4:25 pm 
Newbie

Joined: Wed Oct 19, 2005 12:02 pm
Posts: 5
Location: Woodland Hills, CA
Hi all,

I am running the tutorial as a web application using Tomcat. When I run it, I receive an error saying that the Cat.hbm.xml file cannot be found. I put the file along with the class file in the classes folder under the WEB-INF folder.

I do not seem to have any problems getting to the servlet I created. I am also seeing the following message

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment
).
log4j:WARN Please initialize the log4j system properly.


Any help would be greatly appreciated.

Thank you,

Greg


Top
 Profile  
 
 Post subject: New to Hibernate
PostPosted: Fri Nov 11, 2005 4:49 pm 
Newbie

Joined: Wed Oct 19, 2005 12:02 pm
Posts: 5
Location: Woodland Hills, CA
This is my hibernate.cfg.xml file

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

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">
java:/comp/env/jdbc/PostgreSQL
</property>
<property name="dialect">
net.sf.hibernate.dialect.PostgreSQLDialect
</property>
<mapping resource="Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 11, 2005 4:49 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
put the following lines in a file called log4j.properties. place the file under /WEB-INF/classes and if you are still getting trouble, consult log4j documentation.

log4j.rootCategory=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p %c - %m%n

print the stack trace of the error you are getting, your hibernate.cfg.xml file, as well as the directory path and contents of Cat.hbm.xml.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 11, 2005 4:51 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
you have <mapping resource="Cat.hbm.xml"/> in the conf file. This means you are telling hibernate to look in the root of the classpath (under classes dir). You need to change this to the actual path of the file, so,ething like

<mapping resource="org/hibernate/auction/Bid.hbm.xml" />


Top
 Profile  
 
 Post subject: New to Hibernate
PostPosted: Fri Nov 11, 2005 5:49 pm 
Newbie

Joined: Wed Oct 19, 2005 12:02 pm
Posts: 5
Location: Woodland Hills, CA
Thank you Dennis,

That worked.

Greg


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