-->
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.  [ 7 posts ] 
Author Message
 Post subject: Exception: net.sf.hibernate.MappingException: Error reading
PostPosted: Sun Aug 14, 2005 6:14 am 
Newbie

Joined: Sun Aug 14, 2005 6:07 am
Posts: 14
Location: China
I have deployed my JDBC and JNDI in Tomcat5.0,I have also deployed hibernate.cfg.xml.

This is my Cat.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="net.sf.hibernate.examples.quickstart.Cat" table="CAT">

<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="id" type="string" unsaved-value="null">
<column name="CAT_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="name">
<column name="NAME" sql-type="varchar(16)" not-null="true"/>
</property>

<property name="sex"/>

<property name="weight"/>

</class>

</hibernate-mapping>


But when i run my servlet, it gave out the error:

Exception: net.sf.hibernate.MappingException: Error reading resource: Cat.hbm.xml


What's the possibility of this exception?
How can i resolve it?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 7:24 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Excellent forum name, you'll have many friends around here.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 11:02 am 
Newbie

Joined: Sun Aug 14, 2005 6:07 am
Posts: 14
Location: China
christian wrote:
Excellent forum name, you'll have many friends around here.


Thank u,but can u resolve my problem?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 12:48 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I know, you are waiting :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 2:53 pm 
Newbie

Joined: Sun Aug 14, 2005 2:43 pm
Posts: 2
Location: Tyrol, Austria
Can't tell you what exactly the problem is but maybe you look at the log. There should be a more detailed description of the problem.
If log4j is not enabled yet create a file named log4j.properties with the following entries and put it in the classpath.
Code:
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 - %m%n


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 10:51 pm 
Newbie

Joined: Sun Aug 14, 2005 6:07 am
Posts: 14
Location: China
nagash56 wrote:
Can't tell you what exactly the problem is but maybe you look at the log. There should be a more detailed description of the problem.
If log4j is not enabled yet create a file named log4j.properties with the following entries and put it in the classpath.
Code:
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 - %m%n


Thank u,but how can i use the log4j? Should i write some code in my servlet?And, how can i find the log file?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 4:57 am 
Newbie

Joined: Mon Aug 01, 2005 7:33 am
Posts: 18
Location: UK
Just stick log4j.jar in the root of your application classpath (lib/) and let it do the rest. Log4j comes with hibnernate and just intercepts system out from certain classes,... have a look on the web it is very easy to use and 'install'.

As for the problem - surely the cat.hbm.xml file needs to be in the same directory as the cat.class file - if it is not then change yor deployment descrriptors to make it so.. et voila .... hopefully?!

S :) Immfinished


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