-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping Exception Using Configuration.addFile()
PostPosted: Tue Jan 27, 2004 9:33 pm 
Newbie

Joined: Tue Jan 06, 2004 12:57 am
Posts: 14
I have Hibernate working with the hibernate properties file and the Configuration setup like this:
Configuration cfg = new Configuration().addClass(Customer.class) -- etc.

Now I want a single mapping file for all class-table mappings. I changed the Configuration to this:

Configuration cfg = new Configuration().addFile("/com/company/app/common/hibernate/Mapping.hbm.xml")

Then I put the mapping file under classes like so: /com/company/app/common/hibernate/Mapping.hbm.xml. But I get the mapping exception below (I am using Tomcat version 5).

12:06:34,066 INFO Environment:481 - using CGLIB reflection optimizer
12:06:34,082 INFO Configuration:166 - Mapping file: com/company/app/common/hibernate/Mapping.hbm.xml
12:06:34,145 ERROR Configuration:174 - Could not configure datastore from file:
com/company/app/common/hibernate/Mapping.hbm.xml
java.net.MalformedURLException:
\com\company\app\common\hibernate\Mapping.hbm.xml
(The system cannot find the path specified)

Any ideas?

Rgds,
Jeff.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 28, 2004 12:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Try removing the leading "/". Different environments are varyingly sensitive to it.

If you're doing it programatically anyway, you can always resolve the resource manually and then pass in the full URL path to it.


Top
 Profile  
 
 Post subject: Removing slash didnt work.
PostPosted: Wed Jan 28, 2004 2:15 am 
Newbie

Joined: Tue Jan 06, 2004 12:57 am
Posts: 14
Removing the forward slash did not work (I am using Tomcat).

>>If you're doing it programatically anyway, you can always resolve the >> resource manually and then pass in the full URL path to it.

Not sure what you mean by this. Is there a code sample?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 6:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the Url object in the Java API

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.