Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate-annotations error

 
Ra Carter
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get started with hibernate-annotations but I keep getting this error:

Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List V

Does anyone know what it means? I'm using hibernate rc3 and hibernate-annotations 3.1 beta 5 by the way.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Racarter"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought a NoSuchMethodError occurs when reflection tries to find a method but it isn't there, or like that.

I think it might be in your mappings file, can you post your mapping file for everyone to see.

Mark
 
Peter Laurinec
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by racarter:
[QB]I am trying to get started with hibernate-annotations but I keep getting this error:

Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List V

Hmm, I thing that your annotations are wrong. Can you post here more information, first about your annotations and second about the error you are getting?
 
Fane Preda
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same error here. I'm using hibernate-3.1rc3, hibernate-entitymanager-3.1beta4, hibernate-annotations-3.1beta6 and getting the same error. I suspect there is some version mismatch since I traced this in the debugger and the explanation for the NoSuchMethodError is this:

AnnotationConfiguration calls ExtendedMappings's constructor, which calls



which is a 14 arguments constructor.

super in this case is Mappings which only has this constructor:


which takes 16 arguments, not 14! Since the versions I use are the latest available for download on hibernate.org I'm really out of ideas what to do about this.
[ December 06, 2005: Message edited by: Mike Wazowski ]
 
chris peacock
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RC3 and annotations 5, 6 etc are not compatable,. You need to use hibernate RC2 which is compatable.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Wazowski,
welcome to JavaRanch!

We're a friendly bunch here, but we do have one rule that we take seriously -- the JavaRanch Naming Policy

Basically we require display names to be two words: your first name, a space, then your last name. While we prefer you use your real name, we of corse cannot enforce it. However, obviously fictitious names are not allowed.

Please edit your profile and correct your display name.
 
Fane Preda
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris!
 
Dave Brosius
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a seemingly similar problem. Sorry if this is a hijack, but i think it's related. I get the error:

Caused by: java.lang.NoSuchFieldError: auxiliaryDatabaseObjects
at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:129)
at org.hibernate.cfg.AnnotationConfiguration.addPackage(AnnotationConfiguration.java:119)
at com.mebigfatguy.poolbook.common.HibernateUtil.<clinit>(HibernateUtil.java:19)

when getting the session. I just downloaded hibernate 3.1 and hibernate-annotations 3.1-beta 7, copied over all the jars, and copied the HibernateUtil class as shown in the docs. I added one entity bean, and specified it in the buildSessionFactory preamble.

Anyone have any hints?
 
Michael Kahn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having the same issue,

I'm using:

- Hibernate core 3.1.1
- Annotations 3.1beta6
- manually configured AnnotationConfiguration with addAnnotatedClass calls

And the following stack trace:

(hibernate.HibernateUtil 46 ) Initial SessionFactory creation failed.
java.lang.NoSuchMethodError: org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List V
at org.hibernate.cfg.ExtendedMappings.<init>(ExtendedMappings.java:50)
at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:126)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:253)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1156)
at ca.yorkvilleu.registrar.persistence.hibernate.HibernateUtil.getSessionFactory(HibernateUtil.java:42)
at ca.yorkvilleu.registrar.persistence.hibernate.HibernateUtil.currentSession(HibernateUtil.java:59)
at ca.yorkvilleu.registrar.persistence.hibernate.HibernateEntityManagerProxy.getSession(HibernateEntityManagerProxy.java:30)
at ca.yorkvilleu.registrar.persistence.hibernate.HibernateEntityManagerProxy.persist(HibernateEntityManagerProxy.java:66)
at ca.yorkvilleu.registrar.dao.AbstractManager.save(AbstractManager.java:88)

... and so on ...

The hibernate JIRA doesn't seem to be much help - I could only find one bug report and a sort-of-surly response suggested it was a version mismatch with core - but in my case I'm using the combo suggested in the docs.

???
 
Michael Kahn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, 3.1.1 + 3.1beta8 works.
 
Eric Jo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this issue is addressed at http://forum.hibernate.org/viewtopic.php?p=2245097&sid=57ef81f69c29ed7484680f2bbab9752f

HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic