-->
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: Exception in thread "main" java.lang.NoSuchMethodE
PostPosted: Mon Mar 26, 2007 3:20 am 
Newbie

Joined: Mon Mar 26, 2007 3:07 am
Posts: 4
Hi guys!

I got frustrated with all the NoClassDefFoundError I get everything I'm missing a jar file in my classpath. Now, I tried to copy everything I could from hibernate core and other features(annotation, entitymanager, search, validator, etc). I have to say this is really getting frustrating... I would like to ask for help to determine the source of this problem now...

Quote:
[java] Exception in thread "main" java.lang.NoSuchMethodError: org.hibernat
e.cfg.AnnotationConfiguration.getReflectionManager()Lorg/hibernate/reflection/Re
flectionManager;
[java] at org.hibernate.ejb.EventListenerConfigurator.configure(EventLi
stenerConfigurator.java:156)
[java] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configurati
on.java:869)
[java] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configurati
on.java:183)
[java] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configurati
on.java:240)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFac
tory(HibernatePersistence.java:120)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Pers
istence.java:51)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Pers
istence.java:33)
[java] at hello.HelloWorld.main(Unknown Source)
[java] Java Result: 1


Do you guys know which jar file(again) I could probably missing? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 3:43 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
As it's not a NoClassDefFoundError, it seems like the class was found, but not the right method.

Are you sure you put the right version of the jar (hibernate-annotations, I guess)?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 4:26 am 
Newbie

Joined: Mon Mar 26, 2007 3:07 am
Posts: 4
Thanks! I used the hibernate-annotations.jar that comes with hibernate-annotations-3.3.0.GA. The problem still persists though.

If it would help, here is the main file

Code:
package hello;

import java.util.*;

import javax.persistence.*;

public class HelloWorld
{
    public HelloWorld()
    {
    }

    public static void main(String[] args)
    {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("helloworld");


        EntityManager em = emf.createEntityManager();


        EntityTransaction tx = em.getTransaction();
        tx.begin();

        Message message = new Message("Hello World");

        em.persist(message);


        tx.commit();

        em.close();


        EntityManager newEm = emf.createEntityManager();

        EntityTransaction newTx = newEm.getTransaction();
        newTx.begin();


        List messages = newEm.createQuery("select m from Message m order by m.text asc")
                        .getResultList();


        System.out.println( messages.size() + " message(s) found: " );

        for (Object m : messages)
        {
            Message loadedMsg = (Message)m;
            System.out.println( loadedMsg.getText() );
        }

        newTx.commit();
        newEm.close();

        emf.close();


    }

}



Here are the list of jars in my lib folder
Quote:

ant-1.6.5.jar
ant-antlr-1.6.5.jar
ant-junit-1.6.5.jar
ant-launcher-1.6.5.jar
ant-swing-1.6.5.jar
antlr-2.7.5.jar
antlr-2.7.6.jar
asm-attrs.jar
asm.jar
c3p0-0.9.1.jar
cglib-2.1.3.jar
checkstyle-all.jar
cleanimports.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
concurrent-1.3.2.jar
connector.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate-search.jar
hibernate-tools.jar
hibernate-validator.jar
hibernate3.jar
hsqldb.jar
jaas.jar
jacc-1_0-fr.jar
jars.txt
javassist.jar
jaxen-1.1-beta-7.jar
jboss-archive-browsing.jar
jboss-cache.jar
jboss-common.jar
jboss-jmx.jar
jboss-system.jar
jdbc2_0-stdext.jar
jgroups-2.2.8.jar
jms.jar
jta.jar
junit-3.8.1.jar
log4j-1.2.11.jar
lucene-core-2.1.0.jar
oscache-2.1.jar
proxool-0.8.3.jar
swarmcache-1.0rc2.jar
syndiag2.jar
versioncheck.jar
xerces-2.6.2.jar
xml-apis.jar


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 3:57 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you probably either:
- miss hibernate-common-annotations
- have a legacy hibernate annotataions jar somewhere

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 4:53 am 
Newbie

Joined: Mon Mar 26, 2007 3:07 am
Posts: 4
Thanks guys! I just deleted all the jar files and then copied them again starting from hibernate core and whenever I get a duplicate, I just keep the first ones I copied. Now my class compiles happily. Thanks a lot!


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.