-->
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.  [ 5 posts ] 
Author Message
 Post subject: Somewhat newbie q about dependencies
PostPosted: Tue May 11, 2010 10:29 am 
Newbie

Joined: Tue May 11, 2010 10:11 am
Posts: 2
Hi,

Am trialing the JPA aspects of Hibernate for a spike, but I'm having what I think are dependency problems.

The exact exception thrown is:

Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/annotations/common/AssertionFailure
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:127)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:46)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:30)
[at user code]

I suspect that I'm missing a jar somewhere - most of the trouble I've had with Hibernate so far has been the depenedencies. Is there a clear matrix of what is needed somewhere? It all seems to be a bit of a mess in the maven repo.

I have this in my ivy.xml (I'm using Ivy and ant for build):

<!-- Hibernate dependencies for hbm.xml style -->
<dependency org="org.hibernate"
name="hibernate-core"
rev="3.5.1-Final"/>
<dependency org="org.slf4j"
name="slf4j-log4j12"
rev="1.5.8"/>
<dependency org="org.slf4j"
name="slf4j-api"
rev="1.5.8"/>
<dependency org="javassist"
name="javassist"
rev="3.4.GA"/>
<dependency org="javax.transaction"
name="jta"
rev="1.1"/>

<!-- Needed for JPA style -->
<dependency org="javax.persistence"
name="persistence-api"
rev="1.0"
conf="compile->default"/>
<dependency org="org.hibernate"
name="hibernate-annotations"
rev="3.5.1-Final"/>
<dependency org="org.hibernate"
name="hibernate-entitymanager"
rev="3.5.1-Final"/>
<dependency org="org.hibernate.java-persistence"
name="jpa-api"
rev="2.0-cr-1"/>

although I'm not completely sure I need both the javax.persistence and the org.hibernate.java-persistence dependencies (not that I think that's what's causing the problem).

Oddly, Eclipse is going to org.hibernate.AssertionFailure, not org.hibernate.annotations.common.AssertionFailure when I try to open the type referred to on the import line in AnnotationConfiguration.

Can anyone suggest which dependency I'm missing, or what the root cause of this bugbear might be?

Thanks,

Ben


Top
 Profile  
 
 Post subject: Re: Somewhat newbie q about dependencies
PostPosted: Wed May 12, 2010 5:18 am 
Newbie

Joined: Tue May 11, 2010 10:11 am
Posts: 2
Solved this issue (and recording here for posterity).

The clue was that the ClassNotFoundException was java.lang.ClassNotFoundException: org.hibernate.annotations.common.AssertionFailure - and that class only exists in Hibernate 3.3 - it's been changed to org.hibernate.AssertionFailure by 3.5

The issue was Eclipse, which bundles a version of Hibernate with it, which had got switched on, so was helpfully trying to provide some of Hibernate for me, and causing an impedance mismatch instead.

This was diagnosed by trying a regular command-line ant build instead, which immediately failed due to missing dependencies.


Top
 Profile  
 
 Post subject: Re: Somewhat newbie q about dependencies
PostPosted: Mon Jun 14, 2010 9:24 am 
Newbie

Joined: Mon Jun 14, 2010 9:17 am
Posts: 2
I'm having a similar issue. The error I am getting is...

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.annotations.common.AssertionFailure: Declaring class is not found in the inheritance state hierarchy: com.cc.intrepid.model.RCMQuestionComment

Also using hibernate 3.5 only as far as i can see this has both

org.hibernate.annotations.common.AssertionFailure

and

org.hibernate.AssertionFailure

Did you manage to get yours to work in eclipse (I am using Websphere 7.0 which is built on eclipse)? If so did you manage to turn off the bundled hibernate?


Top
 Profile  
 
 Post subject: Re: Somewhat newbie q about dependencies
PostPosted: Mon Jun 14, 2010 10:23 am 
Newbie

Joined: Mon Jun 14, 2010 9:17 am
Posts: 2
Have kind of fixed this. The RCMQuestionComment class was annotated with @Embeddable, changed this to @Entity and it seems to work, just need to check out all relations and uses of this class to make sure they still work. Not sure why there was a problem though as we have other embeddable classes in the application.

If anyone knows any more about this can you please enlighten me? Thanks


Top
 Profile  
 
 Post subject: Re: Somewhat newbie q about dependencies
PostPosted: Thu Sep 16, 2010 3:39 pm 
Newbie

Joined: Wed Jun 24, 2009 11:58 am
Posts: 2
andtrobs wrote:
org.hibernate.annotations.common.AssertionFailure: Declaring class is not found in the inheritance state hierarchy

This just happened to me when I changed an @Entity to an @Embeddable class; it was because I'd forgotten to remove its @Id variable.


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