-->
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.  [ 10 posts ] 
Author Message
 Post subject: Could not read mapping document from file
PostPosted: Tue Oct 18, 2005 11:33 am 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
I've been getting an error when I run the hbm2ddl ant task after switching to hibernate 3.1 rc2: "Schema text failed: Could not read mapping document from file," followed by the correct path to my mapping xml file, which is also valid. After commenting things out for a while I found that it was getting stuck on a simple string property for which it did not seem to be able to infer the correct type. That is,

<property name="name"/>

fails with the above error, while

<property name="name" type="string"/>

succeeds. This happens even though the class in question includes getters/setters for string properties like this. I also noticed it happening with an id of type string.

This seems so simple, what could be causing this error? BTW it would be nicer if the Hibernate configuration class gave an error message more informative that "could not read mapping document from file," which makes it sound like a path related problem.

Thanks,
Mark Becker


Top
 Profile  
 
 Post subject: 2c
PostPosted: Tue Oct 18, 2005 3:22 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Just my 2 cents:
I recommend bugging H team (submit bugrep) and suggest changing message to something like "Cannot interpret mapping in the file::zzz" for this type of problem, while leaving "Cannot read file:zzz" for the situation when H cannot physically cannot read the file, and "Cannot parse mapping in the file:zzz" for a situation when there are syntax or validation problems.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 4:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the stack trace includes more than just "cannot parse mapping..." - read the *whole* stacktrace.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 5:06 pm 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
There is no stack trace in this instance, only the bare error message about not being able to read the mapping file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 5:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i dont belive that.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 6:20 pm 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
Well, it happens to be true. I have seen a stack trace accompanying the same error message on other occasions, but not now.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 1:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so no stacktrace at all ? How do you run this ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 10:34 am 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
I'm running the schema export ant task (org.hibernate.tool.hbm2ddl.SchemaExportTask) in cygwin, have also seen the same failure when I run ant under eclipse.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 10:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dude ....

in ant:
ant -verbose

in eclipse:
see error log


That will give you the full stacktrace

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 11:15 am 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
It turned out to be a classpath problem in my build.xml, hibernate could not find the class in question when the type for the property in the hibernate mapping file was not specified. But when the property types are explicitly specified it evidently does need to load the class to create the schema.

Makes sense but it was just confusing, especially since in other cases hibernate seems more informative in its error messages even when you are not running ant in verbose mode.


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