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.  [ 3 posts ] 
Author Message
 Post subject: Error reading resource: net/rnet/db/Preferences.hbm.xml
PostPosted: Sun May 09, 2004 2:59 pm 
Newbie

Joined: Sun May 09, 2004 2:45 pm
Posts: 14
I am trying to get a simple hibernate mapping to work with JUnit. There is a 'Preferences.java' and 'Preferences.hbm.xml' file and 'hibernate.cfg.xml'. However, I get a mapping exception saying that 'Preferences.hbm.xml' cannot be found.
1. I've checked the classpath. It's OK. 2. The '<id/> tag in 'Preferences.hbm.xml' looks like this:
<id
name="id"
type="java.lang.Integer"
column="ID" >

<generator class="sequence"/>
</id>


... and it works when using it in Tomcat. However, using it in JUnit causes problems. Here's the exception output:

1) testCreate(net.rnet.ut.TestPreferences)junit.framework.AssertionFailedError: <<< MappingException occured: Error reading resource: net/rnet/db/Preferences.hbm.xml
at net.rnet.ut.TestPreferences.testCreate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


I'd appreciate any ideas from someone who's resolved this before. There seem to be too many obscure classpath issues for hibernate.


-- tim


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 09, 2004 3:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
nothing special for hibernate here....you are loading a resource in 2 different environments...have you tried to add a / in front to ensure it is a absolute path instead of a relative one.

And have you checked if the hbm.xml files is really at that position in the failing environment ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 10, 2004 2:05 am 
Newbie

Joined: Sun May 09, 2004 2:45 pm
Posts: 14
I had to remove a lot of directories in the classpath and now my test is working. Thanks for the hint.

-- tim


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