-->
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.  [ 6 posts ] 
Author Message
 Post subject: ERROR: Could not access the Component..?
PostPosted: Mon Jun 28, 2004 8:22 pm 
Newbie

Joined: Wed Jun 09, 2004 5:29 pm
Posts: 15
Hi, it got this problem...

When i try to run this line:

HibernateService hibernateService = (HibernateService) lookup(HibernateService.ROLE);

it gives me this error:

junit.framework.AssertionFailedError: org.apache.avalon.framework.component.ComponentException: Could not access the Component (key [net.sf.hibernate.avalon.HibernateService])
at junit.framework.Assert.fail(Assert.java:47)
at com.webcellcorp.affection.HibernateCreateUsersTest.setUp



I have included import net.sf.hibernate.avalon.HibernateService so it is not that.
The mapping files look like this:


<class name="User" table="USER" >
<id name="id" type="long" column="USER_ID" unsaved-value="0">
<generator class="native"/>
</id>
<one-to-one name="profile" class="Profile"/>
</class>


<class name="Profile" table="profile" lazy="true">
<id name="id" column="profile_id" type="long">
<generator class="foreign">
<param name="property">user</param>
</generator>
</id>
<one-to-one name="user" class="User" constrained="true"/>
</class>



What am i doing wrong?

Thanks
/Martin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 29, 2004 4:51 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Would say a config problem with avalon. I don't see any hibernate core involved in you stack traces

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 29, 2004 6:47 am 
Newbie

Joined: Wed Jun 09, 2004 5:29 pm
Posts: 15
well if i remove the one-to-one from the User it all works fine, so maybe there is something wrong there...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 29, 2004 8:41 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Swallowed exceptions...

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 29, 2004 10:31 am 
Newbie

Joined: Wed Jun 09, 2004 5:29 pm
Posts: 15
what is Swallowed exceptions?

Anyway, i tried to change the one-to-one to a property and adding get/set for it in the file, and this worked fine.

Are these lines not good enough for a one to one?:

--------------------------
// one to one
private com.corp.prod.om.BasicProfile _basicprofile;

/**
* @hibernate.property
* column=basicprofile
*/
public com.corp.prod.om.BasicProfile getBasicprofile() {
return this._basicprofile;
}

/**
* Set the value related to the column: basicprofile
* @param _basicprofile the basicprofile value
*/
public void setBasicprofile(
com.corp.prod.om.BasicProfile _basicprofile) {
this._basicprofile = _basicprofile;
}
--------------------------


I thought about using subclass instead, but i cant find any example for a joined-subclass in another file (in the FAQ it says you can do this with the extends, but it doesnt seem to work just adding that..)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 30, 2004 6:03 am 
Newbie

Joined: Wed Jun 09, 2004 5:29 pm
Posts: 15
It is funny as it is always the simplest things that can be the hardest to solve...

I finally found out where the error was, I had not seen that you needed to add mapping to the Hibernate.xml in the src/test dir (different hibernate.xml for release and test)!

I would have thought such a common error would have been in the FAQ, or somebody would have recognized the error. Think i'm gonna try to get it added, i lost a whole day because of this little wonder :)


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