Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

hibernate-annotations error

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RC3 and annotations 5, 6 etc are not compatable,. You need to use hibernate RC2 which is compatable.
 
Bartender
Posts: 1843
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Chris!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind, 3.1.1 + 3.1beta8 works.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this issue is addressed at http://forum.hibernate.org/viewtopic.php?p=2245097&sid=57ef81f69c29ed7484680f2bbab9752f

HTH
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic